query_name
stringlengths
13
55
code_file_path
stringlengths
14
194
context_blocks
list
answer_spans
list
supporting_fact_spans
list
example_type
int8
0
1
single_hop
bool
2 classes
subtokenized_input_sequence
list
label_sequence
list
Unused import
chromaway/ngcccbase/ngcccbase/tests/test_txcons.py
[ { "content": "#!/usr/bin/env python\n\nimport os\nimport unittest\n\nfrom pycoin.tx.script import opcodes, tools\n\nfrom coloredcoinlib import (OBColorDefinition, ColorSet,\n SimpleColorValue, ColorTarget, InvalidColorIdError,\n UNCOLORED_MARKER, ZeroSelectError)\n\nfrom ngcccbase.asset import AssetDefinition, AdditiveAssetValue, AssetTarget\nfrom ngcccbase.txcons import (InvalidTargetError, InvalidTransformationError, \n InsufficientFundsError, BasicTxSpec,\n SimpleOperationalTxSpec, RawTxSpec,\n TransactionSpecTransformer)\nfrom ngcccbase.pwallet import PersistentWallet\n\n\n\n\n\nif __name__ == '__main__':\n unittest.main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestTxcons(unittest.TestCase):\n\n\n\n\n\n\n\n", "metadata": "root.TestTxcons", "header": "['module', '___EOS___']", "index": 20 }, { "content": " def setUp(self):\n self.path = \":memory:\"\n self.pwallet = PersistentWallet(self.path)\n self.config = {'dw_master_key': 'test', 'testnet': True, 'ccc': {\n 'colordb_path' : self.path}, 'bip0032': False }\n self.pwallet.wallet_config = self.config\n self.pwallet.init_model()\n self.model = self.pwallet.get_model()\n self.colormap = self.model.get_color_map()\n\n self.colordesc0 = \"obc:color0:0:0\"\n self.colordesc1 = \"obc:color1:0:0\"\n self.colordesc2 = \"obc:color2:0:0\"\n\n # add some colordescs\n self.colorid0 = self.colormap.resolve_color_desc(self.colordesc0)\n self.colorid1 = self.colormap.resolve_color_desc(self.colordesc1)\n self.colorid2 = self.colormap.resolve_color_desc(self.colordesc2)\n\n self.colordef0 = OBColorDefinition(\n self.colorid0, {'txhash': 'color0', 'outindex': 0})\n self.colordef1 = OBColorDefinition(\n self.colorid1, {'txhash': 'color1', 'outindex': 0})\n self.colordef2 = OBColorDefinition(\n self.colorid2, {'txhash': 'color2', 'outindex': 0})\n\n self.asset_config = {\n 'monikers': ['blue'],\n 'color_set': [self.colordesc0],\n }\n self.basset_config = {\n 'monikers': ['bitcoin'],\n 'color_set': [''],\n }\n self.asset = AssetDefinition(self.colormap, self.asset_config)\n self.basset = AssetDefinition(self.colormap, self.basset_config)\n self.basic = BasicTxSpec(self.model)\n self.bbasic = BasicTxSpec(self.model)\n\n wam = self.model.get_address_manager()\n self.address0 = wam.get_new_address(self.asset.get_color_set())\n self.addr0 = self.address0.get_address()\n\n self.bcolorset = ColorSet(self.colormap, [''])\n self.baddress = wam.get_new_address(self.bcolorset)\n self.baddr = self.baddress.get_address()\n\n self.assetvalue0 = AdditiveAssetValue(asset=self.asset, value=5)\n self.assetvalue1 = AdditiveAssetValue(asset=self.asset, value=6)\n self.assetvalue2 = AdditiveAssetValue(asset=self.asset, value=7)\n self.bassetvalue = AdditiveAssetValue(asset=self.basset, value=8)\n self.assettarget0 = AssetTarget(self.addr0, self.assetvalue0)\n self.assettarget1 = AssetTarget(self.addr0, self.assetvalue1)\n self.assettarget2 = AssetTarget(self.addr0, self.assetvalue2)\n self.bassettarget = AssetTarget(self.baddr, self.bassetvalue)\n\n self.atargets = [self.assettarget0, self.assettarget1, self.assettarget2]\n\n # add some targets\n self.colorvalue0 = SimpleColorValue(colordef=self.colordef0, value=5)\n self.colortarget0 = ColorTarget(self.addr0, self.colorvalue0)\n self.colorvalue1 = SimpleColorValue(colordef=self.colordef0, value=6)\n self.colortarget1 = ColorTarget(self.addr0, self.colorvalue1)\n self.colorvalue2 = SimpleColorValue(colordef=self.colordef0, value=7)\n self.colortarget2 = ColorTarget(self.addr0, self.colorvalue2)\n self.bcolorvalue = SimpleColorValue(colordef=UNCOLORED_MARKER, value=8)\n self.bcolortarget = ColorTarget(self.baddr, self.bcolorvalue)\n\n self.targets = [self.colortarget0, self.colortarget1,\n self.colortarget2]\n self.transformer = TransactionSpecTransformer(self.model, self.config)\n self.blockhash = '00000000c927c5d0ee1ca362f912f83c462f644e695337ce3731b9f7c5d1ca8c'\n self.txhash = '4fe45a5ba31bab1e244114c4555d9070044c73c98636231c77657022d76b87f7'", "metadata": "root.TestTxcons.setUp", "header": "['class', 'TestTxcons', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 22 }, { "content": " def test_basic(self):\n self.assertRaises(InvalidTargetError, self.basic.is_monocolor)\n self.assertRaises(InvalidTargetError,\n self.basic.add_target, self.colortarget0)\n self.basic.add_target(self.assettarget0)\n self.basic.add_target(self.assettarget1)\n self.basic.add_target(self.assettarget2)\n self.assertEqual(self.basic.is_monocolor(), True)\n self.assertEqual(self.basic.is_monoasset(), True)\n self.assertEqual(self.basic.targets, self.atargets)\n self.basic.add_target(self.bassettarget)\n self.assertEqual(self.basic.is_monoasset(), False)\n self.assertEqual(self.basic.is_monocolor(), False)\n self.assertRaises(InvalidTransformationError,\n self.basic.make_operational_tx_spec, self.asset)", "metadata": "root.TestTxcons.test_basic", "header": "['class', 'TestTxcons', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 96 }, { "content": " def add_coins(self):\n script = tools.compile(\n \"OP_DUP OP_HASH160 {0} OP_EQUALVERIFY OP_CHECKSIG\".format(\n self.address0.rawPubkey().encode(\"hex\"))).encode(\"hex\")\n\n self.model.utxo_man.store.add_utxo(self.addr0, self.txhash,\n 0, 100, script)\n\n script = tools.compile(\n \"OP_DUP OP_HASH160 {0} OP_EQUALVERIFY OP_CHECKSIG\".format(\n self.baddress.rawPubkey().encode(\"hex\"))).encode(\"hex\")\n\n self.model.utxo_man.store.add_utxo(self.baddr, self.txhash,\n 1, 20000, script)\n self.model.ccc.metastore.set_as_scanned(self.colorid0, self.blockhash)\n self.model.ccc.cdstore.add(self.colorid0, self.txhash, 0, 100, '')", "metadata": "root.TestTxcons.add_coins", "header": "['class', 'TestTxcons', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 112 }, { "content": " def test_operational(self):\n self.basic.add_target(self.assettarget0)\n self.basic.add_target(self.assettarget1)\n self.basic.add_target(self.assettarget2)\n op = self.transformer.transform_basic(self.basic, 'operational')\n self.assertTrue(self.transformer.classify_tx_spec(op), 'operational')\n self.assertRaises(InvalidTargetError, op.add_target, 1)\n self.assertEqual(ColorTarget.sum(op.get_targets()),\n ColorTarget.sum(self.targets))\n self.assertEqual(op.get_change_addr(self.colordef0), self.addr0)\n self.assertEqual(op.get_change_addr(UNCOLORED_MARKER), self.baddr)\n self.assertEqual(op.get_required_fee(1).get_value(), 10000)\n self.assertRaises(InvalidColorIdError, op.get_change_addr,\n self.colordef1)\n cv = SimpleColorValue(colordef=self.colordef0, value=0)\n self.assertRaises(ZeroSelectError, op.select_coins, cv)\n cv = SimpleColorValue(colordef=self.colordef0, value=5)\n self.assertRaises(InsufficientFundsError, op.select_coins, cv)\n self.add_coins()\n self.assertEqual(op.select_coins(cv)[1].get_value(), 100)", "metadata": "root.TestTxcons.test_operational", "header": "['class', 'TestTxcons', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 130 }, { "content": " def test_composed(self):\n self.basic.add_target(self.assettarget0)\n self.basic.add_target(self.assettarget1)\n self.basic.add_target(self.assettarget2)\n self.add_coins()\n op = self.transformer.transform(self.basic, 'operational')\n self.assertEqual(op.get_change_addr(self.colordef0), self.addr0)\n self.assertEqual(op.get_change_addr(UNCOLORED_MARKER), self.baddr)\n comp = self.transformer.transform(op, 'composed')\n self.assertTrue(self.transformer.classify_tx_spec(comp), 'composed')\n signed = self.transformer.transform(comp, 'signed')\n self.assertTrue(self.transformer.classify_tx_spec(signed), 'signed')\n self.assertEqual(len(signed.get_hex_txhash()), 64)\n txdata = signed.get_tx_data()\n same = RawTxSpec.from_tx_data(self.model, txdata)\n self.assertEqual(same.get_hex_tx_data(), signed.get_hex_tx_data())\n self.assertRaises(InvalidTransformationError,\n self.transformer.transform,\n signed, '')", "metadata": "root.TestTxcons.test_composed", "header": "['class', 'TestTxcons', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 152 }, { "content": " def test_other(self):\n self.assertEqual(self.transformer.classify_tx_spec(1), None)\n self.assertRaises(InvalidTransformationError,\n self.transformer.transform_basic,\n self.basic, '')\n self.assertRaises(InvalidTransformationError,\n self.transformer.transform_operational,\n self.basic, '')\n self.assertRaises(InvalidTransformationError,\n self.transformer.transform_composed,\n self.basic, '')\n self.assertRaises(InvalidTransformationError,\n self.transformer.transform_signed,\n self.basic, '')\n self.assertRaises(InvalidTransformationError,\n self.transformer.transform,\n '', '')\n self.add_coins()\n self.bbasic.add_target(self.bassettarget)\n signed = self.transformer.transform(self.bbasic, 'signed')\n self.assertEqual(len(signed.get_hex_txhash()), 64)", "metadata": "root.TestTxcons.test_other", "header": "['class', 'TestTxcons', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 172 } ]
[ { "span": "import os", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 9 }, { "span": "from pycoin.tx.script import opcodes, tools", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 43 }, { "span": "from ngcccbase.txcons import (InvalidTargetError, InvalidTransformationError, \n InsufficientFundsError, BasicTxSpec,\n SimpleOperationalTxSpec, RawTxSpec,\n TransactionSpecTransformer)", "start_line": 12, "start_column": 0, "end_line": 15, "end_column": 57 } ]
[]
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_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pyco", "in_", "._", "tx_", "._", "script_", "import_", "opcodes_", ",_", "tools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "colore", "dco", "inli", "b_", "import_", "(_", "OB", "Color", "Definition_", ",_", "Color", "Set_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Simple", "Color", "Value_", ",_", "Color", "Target_", ",_", "Inva", "lid", "Color", "Id", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "UNC", "OLO", "RED", "\\u", "MARKER", "_", ",_", "Zero", "Select", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "ng", "ccc", "base_", "._", "asset_", "import_", "Asset", "Definition_", ",_", "Add", "iti", "ve", "Asset", "Value_", ",_", "Asset", "Target_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ng", "ccc", "base_", "._", "tx", "cons_", "import_", "(_", "Inva", "lid", "Target", "Error_", ",_", "Inva", "lid", "Transformation", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Ins", "uff", "icient", "Fund", "s", "Error_", ",_", "Basic", "Tx", "Spec_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Simple", "Opera", "tion", "al", "Tx", "Spec_", ",_", "Ra", "w", "Tx", "Spec_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Transa", "ction", "Spec", "Transformer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ng", "ccc", "base_", "._", "pw", "alle", "t_", "import_", "Persisten", "t", "Wallet_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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", "Tx", "cons_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Tx", "cons_", "(_", "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_", "._", "path_", "=_", "\":", "memory", ":\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pw", "alle", "t_", "=_", "Persisten", "t", "Wallet_", "(_", "self_", "._", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "config_", "=_", "{_", "'", "dw", "\\u", "master", "\\u", "key", "'_", ":_", "'", "test", "'_", ",_", "'", "testn", "et", "'_", ":_", "True_", ",_", "'", "ccc", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "color", "db", "\\u", "path", "'_", ":_", "self_", "._", "path_", "}_", ",_", "'", "bip", "003", "2", "'_", ":_", "False_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pw", "alle", "t_", "._", "walle", "t", "\\u", "config_", "=_", "self_", "._", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pw", "alle", "t_", "._", "init", "\\u", "model_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "model_", "=_", "self_", "._", "pw", "alle", "t_", "._", "get", "\\u", "model_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "colormap_", "=_", "self_", "._", "model_", "._", "get", "\\u", "color", "\\u", "map_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "color", "desc", "0_", "=_", "\"", "ob", "c", ":", "color", "0", ":", "0", ":", "0", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "color", "desc", "1_", "=_", "\"", "ob", "c", ":", "color", "1", ":", "0", ":", "0", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "color", "desc", "2_", "=_", "\"", "ob", "c", ":", "color", "2", ":", "0", ":", "0", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "some", " ", "color", "desc", "s_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "colori", "d0_", "=_", "self_", "._", "colormap_", "._", "resolve", "\\u", "color", "\\u", "desc_", "(_", "self_", "._", "color", "desc", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "colori", "d1_", "=_", "self_", "._", "colormap_", "._", "resolve", "\\u", "color", "\\u", "desc_", "(_", "self_", "._", "color", "desc", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "colori", "d2_", "=_", "self_", "._", "colormap_", "._", "resolve", "\\u", "color", "\\u", "desc_", "(_", "self_", "._", "color", "desc", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "color", "def", "0_", "=_", "OB", "Color", "Definition_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "colori", "d0_", ",_", "{_", "'", "tx", "hash", "'_", ":_", "'", "color", "0", "'_", ",_", "'", "outin", "dex", "'_", ":_", "0_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "color", "def", "1_", "=_", "OB", "Color", "Definition_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "colori", "d1_", ",_", "{_", "'", "tx", "hash", "'_", ":_", "'", "color", "1", "'_", ",_", "'", "outin", "dex", "'_", ":_", "0_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "color", "def", "2_", "=_", "OB", "Color", "Definition_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "colori", "d2_", ",_", "{_", "'", "tx", "hash", "'_", ":_", "'", "color", "2", "'_", ",_", "'", "outin", "dex", "'_", ":_", "0_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "asset", "\\u", "config_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mon", "ike", "rs", "'_", ":_", "[_", "'", "blue", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "color", "\\u", "set", "'_", ":_", "[_", "self_", "._", "color", "desc", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bass", "et", "\\u", "config_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mon", "ike", "rs", "'_", ":_", "[_", "'", "bitcoin", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "color", "\\u", "set", "'_", ":_", "[_", "''_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "asset_", "=_", "Asset", "Definition_", "(_", "self_", "._", "colormap_", ",_", "self_", "._", "asset", "\\u", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bass", "et_", "=_", "Asset", "Definition_", "(_", "self_", "._", "colormap_", ",_", "self_", "._", "bass", "et", "\\u", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "basic_", "=_", "Basic", "Tx", "Spec_", "(_", "self_", "._", "model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bba", "sic", "_", "=_", "Basic", "Tx", "Spec_", "(_", "self_", "._", "model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wam", "_", "=_", "self_", "._", "model_", "._", "get", "\\u", "address", "\\u", "manager_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "address", "0_", "=_", "wam", "_", "._", "get", "\\u", "new", "\\u", "address_", "(_", "self_", "._", "asset_", "._", "get", "\\u", "color", "\\u", "set_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "addr", "0_", "=_", "self_", "._", "address", "0_", "._", "get", "\\u", "address_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "bco", "lor", "set_", "=_", "Color", "Set_", "(_", "self_", "._", "colormap_", ",_", "[_", "''_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bad", "dress", "_", "=_", "wam", "_", "._", "get", "\\u", "new", "\\u", "address_", "(_", "self_", "._", "bco", "lor", "set_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bad", "dr_", "=_", "self_", "._", "bad", "dress", "_", "._", "get", "\\u", "address_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "asset", "value", "0_", "=_", "Add", "iti", "ve", "Asset", "Value_", "(_", "asset_", "=_", "self_", "._", "asset_", ",_", "value_", "=_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "asset", "value1_", "=_", "Add", "iti", "ve", "Asset", "Value_", "(_", "asset_", "=_", "self_", "._", "asset_", ",_", "value_", "=_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "asset", "value2_", "=_", "Add", "iti", "ve", "Asset", "Value_", "(_", "asset_", "=_", "self_", "._", "asset_", ",_", "value_", "=_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bass", "et", "value_", "=_", "Add", "iti", "ve", "Asset", "Value_", "(_", "asset_", "=_", "self_", "._", "bass", "et_", ",_", "value_", "=_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "asset", "target", "0_", "=_", "Asset", "Target_", "(_", "self_", "._", "addr", "0_", ",_", "self_", "._", "asset", "value", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "asset", "target", "1_", "=_", "Asset", "Target_", "(_", "self_", "._", "addr", "0_", ",_", "self_", "._", "asset", "value1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "asset", "target", "2_", "=_", "Asset", "Target_", "(_", "self_", "._", "addr", "0_", ",_", "self_", "._", "asset", "value2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bass", "ett", "arget", "_", "=_", "Asset", "Target_", "(_", "self_", "._", "bad", "dr_", ",_", "self_", "._", "bass", "et", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "ata", "rget", "s_", "=_", "[_", "self_", "._", "asset", "target", "0_", ",_", "self_", "._", "asset", "target", "1_", ",_", "self_", "._", "asset", "target", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "some", " ", "targets_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "color", "value", "0_", "=_", "Simple", "Color", "Value_", "(_", "color", "def_", "=_", "self_", "._", "color", "def", "0_", ",_", "value_", "=_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "color", "target", "0_", "=_", "Color", "Target_", "(_", "self_", "._", "addr", "0_", ",_", "self_", "._", "color", "value", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "color", "value1_", "=_", "Simple", "Color", "Value_", "(_", "color", "def_", "=_", "self_", "._", "color", "def", "0_", ",_", "value_", "=_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "color", "target", "1_", "=_", "Color", "Target_", "(_", "self_", "._", "addr", "0_", ",_", "self_", "._", "color", "value1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "color", "value2_", "=_", "Simple", "Color", "Value_", "(_", "color", "def_", "=_", "self_", "._", "color", "def", "0_", ",_", "value_", "=_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "color", "target", "2_", "=_", "Color", "Target_", "(_", "self_", "._", "addr", "0_", ",_", "self_", "._", "color", "value2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bco", "lor", "value_", "=_", "Simple", "Color", "Value_", "(_", "color", "def_", "=_", "UNC", "OLO", "RED", "\\u", "MARKER", "_", ",_", "value_", "=_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bco", "lor", "target_", "=_", "Color", "Target_", "(_", "self_", "._", "bad", "dr_", ",_", "self_", "._", "bco", "lor", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "targets_", "=_", "[_", "self_", "._", "color", "target", "0_", ",_", "self_", "._", "color", "target", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "color", "target", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "transformer_", "=_", "Transa", "ction", "Spec", "Transformer_", "(_", "self_", "._", "model_", ",_", "self_", "._", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "block", "hash_", "=_", "'", "00000000", "c9", "2", "7c", "5d", "0e", "e1", "ca", "362", "f9", "1", "2f", "8", "3c", "462", "f6", "4", "4e", "695", "337", "ce", "373", "1b", "9", "f7", "c5", "d1", "ca", "8c", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tx", "hash_", "=_", "'", "4f", "e4", "5a", "5b", "a3", "1b", "ab", "1e", "244", "114", "c4", "555", "d", "907", "004", "4c", "7", "3c", "986", "362", "3", "1c", "776", "570", "2", "2d", "7", "6b", "87", "f7", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Tx", "cons_", "(_", "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_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Raises_", "(_", "Inva", "lid", "Target", "Error_", ",_", "self_", "._", "basic_", "._", "is", "\\u", "mono", "color_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Inva", "lid", "Target", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "basic_", "._", "add", "\\u", "target_", ",_", "self_", "._", "color", "target", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "basic_", "._", "add", "\\u", "target_", "(_", "self_", "._", "asset", "target", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "basic_", "._", "add", "\\u", "target_", "(_", "self_", "._", "asset", "target", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "basic_", "._", "add", "\\u", "target_", "(_", "self_", "._", "asset", "target", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "basic_", "._", "is", "\\u", "mono", "color_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "basic_", "._", "is", "\\u", "mono", "asset_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "basic_", "._", "targets_", ",_", "self_", "._", "ata", "rget", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "basic_", "._", "add", "\\u", "target_", "(_", "self_", "._", "bass", "ett", "arget", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "basic_", "._", "is", "\\u", "mono", "asset_", "(_", ")_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "basic_", "._", "is", "\\u", "mono", "color_", "(_", ")_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Inva", "lid", "Transformation", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "basic_", "._", "make", "\\u", "operati", "onal", "\\u", "tx", "\\u", "spec_", ",_", "self_", "._", "asset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Tx", "cons_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "coins_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "script_", "=_", "tools_", "._", "compile_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "OP", "\\u", "DU", "P", " ", "OP", "\\u", "HAS", "H1", "60", " ", "{", "0", "}", " ", "OP", "\\u", "EQUAL", "VERIFY", " ", "OP", "\\u", "CHECKS", "IG", "\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "address", "0_", "._", "raw", "Pub", "key_", "(_", ")_", "._", "encode_", "(_", "\"", "hex", "\"_", ")_", ")_", ")_", "._", "encode_", "(_", "\"", "hex", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "model_", "._", "utxo", "\\u", "man_", "._", "store_", "._", "add", "\\u", "utxo", "_", "(_", "self_", "._", "addr", "0_", ",_", "self_", "._", "tx", "hash_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ",_", "100_", ",_", "script_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "script_", "=_", "tools_", "._", "compile_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "OP", "\\u", "DU", "P", " ", "OP", "\\u", "HAS", "H1", "60", " ", "{", "0", "}", " ", "OP", "\\u", "EQUAL", "VERIFY", " ", "OP", "\\u", "CHECKS", "IG", "\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "bad", "dress", "_", "._", "raw", "Pub", "key_", "(_", ")_", "._", "encode_", "(_", "\"", "hex", "\"_", ")_", ")_", ")_", "._", "encode_", "(_", "\"", "hex", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "model_", "._", "utxo", "\\u", "man_", "._", "store_", "._", "add", "\\u", "utxo", "_", "(_", "self_", "._", "bad", "dr_", ",_", "self_", "._", "tx", "hash_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ",_", "20000_", ",_", "script_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "model_", "._", "ccc", "_", "._", "metas", "tore_", "._", "set\\u", "as", "\\u", "scanned", "_", "(_", "self_", "._", "colori", "d0_", ",_", "self_", "._", "block", "hash_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "model_", "._", "ccc", "_", "._", "cds", "tore_", "._", "add_", "(_", "self_", "._", "colori", "d0_", ",_", "self_", "._", "tx", "hash_", ",_", "0_", ",_", "100_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Tx", "cons_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "operati", "onal", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "basic_", "._", "add", "\\u", "target_", "(_", "self_", "._", "asset", "target", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "basic_", "._", "add", "\\u", "target_", "(_", "self_", "._", "asset", "target", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "basic_", "._", "add", "\\u", "target_", "(_", "self_", "._", "asset", "target", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "op_", "=_", "self_", "._", "transformer_", "._", "transform", "\\u", "basic_", "(_", "self_", "._", "basic_", ",_", "'", "operati", "onal", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "transformer_", "._", "classify", "\\u", "tx", "\\u", "spec_", "(_", "op_", ")_", ",_", "'", "operati", "onal", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Inva", "lid", "Target", "Error_", ",_", "op_", "._", "add", "\\u", "target_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "Color", "Target_", "._", "sum_", "(_", "op_", "._", "get", "\\u", "targets_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Color", "Target_", "._", "sum_", "(_", "self_", "._", "targets_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "op_", "._", "get", "\\u", "change", "\\u", "addr_", "(_", "self_", "._", "color", "def", "0_", ")_", ",_", "self_", "._", "addr", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "op_", "._", "get", "\\u", "change", "\\u", "addr_", "(_", "UNC", "OLO", "RED", "\\u", "MARKER", "_", ")_", ",_", "self_", "._", "bad", "dr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "op_", "._", "get", "\\u", "require", "d\\u", "fee_", "(_", "1_", ")_", "._", "get", "\\u", "value_", "(_", ")_", ",_", "10000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Inva", "lid", "Color", "Id", "Error_", ",_", "op_", "._", "get", "\\u", "change", "\\u", "addr_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "color", "def", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cv_", "=_", "Simple", "Color", "Value_", "(_", "color", "def_", "=_", "self_", "._", "color", "def", "0_", ",_", "value_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Zero", "Select", "Error_", ",_", "op_", "._", "select", "\\u", "coins_", ",_", "cv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cv_", "=_", "Simple", "Color", "Value_", "(_", "color", "def_", "=_", "self_", "._", "color", "def", "0_", ",_", "value_", "=_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Ins", "uff", "icient", "Fund", "s", "Error_", ",_", "op_", "._", "select", "\\u", "coins_", ",_", "cv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "\\u", "coins_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "op_", "._", "select", "\\u", "coins_", "(_", "cv_", ")_", "[_", "1_", "]_", "._", "get", "\\u", "value_", "(_", ")_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Tx", "cons_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "compose", "d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "basic_", "._", "add", "\\u", "target_", "(_", "self_", "._", "asset", "target", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "basic_", "._", "add", "\\u", "target_", "(_", "self_", "._", "asset", "target", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "basic_", "._", "add", "\\u", "target_", "(_", "self_", "._", "asset", "target", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "\\u", "coins_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "op_", "=_", "self_", "._", "transformer_", "._", "transform_", "(_", "self_", "._", "basic_", ",_", "'", "operati", "onal", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "op_", "._", "get", "\\u", "change", "\\u", "addr_", "(_", "self_", "._", "color", "def", "0_", ")_", ",_", "self_", "._", "addr", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "op_", "._", "get", "\\u", "change", "\\u", "addr_", "(_", "UNC", "OLO", "RED", "\\u", "MARKER", "_", ")_", ",_", "self_", "._", "bad", "dr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comp_", "=_", "self_", "._", "transformer_", "._", "transform_", "(_", "op_", ",_", "'", "compose", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "transformer_", "._", "classify", "\\u", "tx", "\\u", "spec_", "(_", "comp_", ")_", ",_", "'", "compose", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "signed_", "=_", "self_", "._", "transformer_", "._", "transform_", "(_", "comp_", ",_", "'", "sign", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "transformer_", "._", "classify", "\\u", "tx", "\\u", "spec_", "(_", "signed_", ")_", ",_", "'", "sign", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "signed_", "._", "get", "\\u", "hex", "\\u", "tx", "hash_", "(_", ")_", ")_", ",_", "64_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tx", "data_", "=_", "signed_", "._", "get", "\\u", "tx", "\\u", "data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "same_", "=_", "Ra", "w", "Tx", "Spec_", "._", "from", "\\u", "tx", "\\u", "data_", "(_", "self_", "._", "model_", ",_", "tx", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "same_", "._", "get", "\\u", "hex", "\\u", "tx", "\\u", "data_", "(_", ")_", ",_", "signed_", "._", "get", "\\u", "hex", "\\u", "tx", "\\u", "data_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Inva", "lid", "Transformation", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "transformer_", "._", "transform_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "signed_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Tx", "cons_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "other_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "transformer_", "._", "classify", "\\u", "tx", "\\u", "spec_", "(_", "1_", ")_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Inva", "lid", "Transformation", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "transformer_", "._", "transform", "\\u", "basic_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "basic_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Inva", "lid", "Transformation", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "transformer_", "._", "transform", "\\u", "operati", "onal", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "basic_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Inva", "lid", "Transformation", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "transformer_", "._", "transform", "\\u", "compose", "d_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "basic_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Inva", "lid", "Transformation", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "transformer_", "._", "transform", "\\u", "signed_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "basic_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Inva", "lid", "Transformation", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "transformer_", "._", "transform_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "''_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "\\u", "coins_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bba", "sic", "_", "._", "add", "\\u", "target_", "(_", "self_", "._", "bass", "ett", "arget", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "signed_", "=_", "self_", "._", "transformer_", "._", "transform_", "(_", "self_", "._", "bba", "sic", "_", ",_", "'", "sign", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "signed_", "._", "get", "\\u", "hex", "\\u", "tx", "hash_", "(_", ")_", ")_", ",_", "64_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 0, 1, 1, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
codesters/codesters/resources/views.py
[ { "content": "from django.core.exceptions import ObjectDoesNotExist\nfrom django.shortcuts import get_object_or_404, render_to_response\nfrom django.core.urlresolvers import reverse_lazy, reverse\nfrom django.contrib import messages\nfrom django.utils.datastructures import SortedDict\nfrom django.http import HttpResponse, HttpResponseRedirect, Http404\nfrom django.template import RequestContext\nfrom django.views.generic import TemplateView, ListView, DetailView, CreateView, UpdateView, RedirectView\nfrom guardian.mixins import LoginRequiredMixin, PermissionRequiredMixin\nfrom braces.views import SetHeadlineMixin\nfrom djangoratings.views import AddRatingView\n\nfrom django.contrib.auth.models import User\nfrom django.contrib.contenttypes.models import ContentType\nfrom .models import Resource, Topic, ResourceType, FeaturedResource\nfrom profiles.models import SavedResource, TopicFollow\n\nfrom .forms import ResourceCreateForm, ResourceUpdateForm, TopicCreateForm, TopicUpdateForm\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", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def resource_home(request):\n topics = Topic.objects.filter(resource__title__isnull=False).distinct().order_by('name')\n\n #Check various session values for user details and show appropriate info\n #if request.session.get('no_name', False):\n # messages.info(request, 'Please fill in your profile details by going to your account settings.')\n # request.session['no_name'] = False\n\n if request.session.get('no_topic', False):\n messages.warning(request, 'It seems you are not following any topic. Follow topics by clicking on it below and get personalized recommendations')\n request.session['no_topic'] = False\n\n ctx = {\n 'topics': topics,\n }\n return render_to_response('resources/resource_home.html', ctx, context_instance=RequestContext(request))", "metadata": "root.resource_home", "header": "['module', '___EOS___']", "index": 19 }, { "content": "def rate_resource(request, object_id, score):\n model = 'resource'\n app_label = 'resources'\n field_name ='rating'\n try:\n content_type = ContentType.objects.get(model=model, app_label=app_label)\n except ContentType.DoesNotExist:\n raise Http404('Invalid `model` or `app_label`.')\n params = {\n 'content_type_id': content_type.id,\n 'object_id': object_id,\n 'field_name': field_name,\n 'score': score,\n }\n response = AddRatingView()(request, **params)\n if response.status_code == 200:\n if response.content == 'Vote recorded.':\n messages.success(request, 'Thanks, Your Vote is recorded')\n else:\n messages.error(request, 'Sorry, Something went wrong')\n return HttpResponseRedirect(request.META['HTTP_REFERER'])", "metadata": "root.rate_resource", "header": "['module', '___EOS___']", "index": 36 }, { "content": "class ResourceSaveView(LoginRequiredMixin, RedirectView):\n permanent = False\n", "metadata": "root.ResourceSaveView", "header": "['module', '___EOS___']", "index": 59 }, { "content": " def get_redirect_url(self, pk):\n resource = get_object_or_404(Resource, pk=pk)\n SavedResource.objects.get_or_create(user=self.request.user, resource=resource)\n if self.request.META['HTTP_REFERER']:\n return self.request.META['HTTP_REFERER']\n else:\n return reverse_lazy('resource_detail', kwargs={'pk':pk})", "metadata": "root.ResourceSaveView.get_redirect_url", "header": "['class', 'ResourceSaveView', '(', 'LoginRequiredMixin', ',', 'RedirectView', ')', ':', '___EOS___']", "index": 62 }, { "content": "class ResourceFeatureView(LoginRequiredMixin, RedirectView):\n permanent = False\n permission_required = 'resources.change_featuredresource'\n return_403 = True\n", "metadata": "root.ResourceFeatureView", "header": "['module', '___EOS___']", "index": 71 }, { "content": " def get_redirect_url(self, pk, slug):\n resource = get_object_or_404(Resource, pk=pk)\n topic = get_object_or_404(Topic, slug=slug)\n resource.make_featured(topic=topic)\n if self.request.META['HTTP_REFERER']:\n return self.request.META['HTTP_REFERER']\n else:\n return reverse_lazy('resource_detail', kwargs={'pk':pk})", "metadata": "root.ResourceFeatureView.get_redirect_url", "header": "['class', 'ResourceFeatureView', '(', 'LoginRequiredMixin', ',', 'RedirectView', ')', ':', '___EOS___']", "index": 76 }, { "content": "class SidebarMixin(object):", "metadata": "root.SidebarMixin", "header": "['module', '___EOS___']", "index": 86 }, { "content": " def get_context_data(self, **kwargs):\n context = super(SidebarMixin, self).get_context_data(**kwargs)\n topics = Topic.objects.filter(resource__title__isnull=False).distinct().order_by('name')\n context['topics'] = topics\n return context", "metadata": "root.SidebarMixin.get_context_data", "header": "['class', 'SidebarMixin', '(', 'object', ')', ':', '___EOS___']", "index": 87 }, { "content": "class ResourceAllListView(SetHeadlineMixin, SidebarMixin, ListView):\n context_object_name = 'resources'\n template_name = 'resources/resource_list.html'\n paginate_by = 12\n", "metadata": "root.ResourceAllListView", "header": "['module', '___EOS___']", "index": 94 }, { "content": " def get_queryset(self):\n level_to_get = None\n if 'level' in self.request.GET:\n level_to_get = self.request.GET['level']\n resources = Resource.objects.all()\n if level_to_get:\n resources = resources.filter(level=level_to_get)\n self.headline = 'All Resources'\n return resources", "metadata": "root.ResourceAllListView.get_queryset", "header": "['class', 'ResourceAllListView', '(', 'SetHeadlineMixin', ',', 'SidebarMixin', ',', 'ListView', ')', ':', '___EOS___']", "index": 99 }, { "content": "class TopicFollowView(LoginRequiredMixin, RedirectView):\n permanent = False\n", "metadata": "root.TopicFollowView", "header": "['module', '___EOS___']", "index": 110 }, { "content": " def get_redirect_url(self, slug):\n topic = get_object_or_404(Topic, slug=slug)\n try:\n tf = TopicFollow.objects.get(user=self.request.user, topic=topic)\n tf.delete()\n messages.success(self.request, 'You have stopped following this topic.')\n except TopicFollow.DoesNotExist:\n TopicFollow.objects.create(user=self.request.user, topic=topic)\n messages.success(self.request, 'You are now following this topic.')\n return reverse_lazy('resource_topic_home', kwargs={'slug':slug})", "metadata": "root.TopicFollowView.get_redirect_url", "header": "['class', 'TopicFollowView', '(', 'LoginRequiredMixin', ',', 'RedirectView', ')', ':', '___EOS___']", "index": 113 }, { "content": "def topic_home(request, slug):\n current_topic = get_object_or_404(Topic, slug=slug)\n headline = \"\"\"Learn \"\"\" + unicode(current_topic.name).capitalize() + \"\"\" - from the best tutorials and online courses\"\"\"\n topics = Topic.objects.filter(resource__title__isnull=False).distinct().order_by('name')\n\n ctx = {\n 'current_topic': current_topic,\n 'headline': headline,\n 'topics': topics\n }\n\n resourcetypes = []\n res_types = ResourceType.objects.all().order_by('name')\n for res_type in res_types:\n try:\n result = FeaturedResource.objects.get(topic=current_topic, resource_type=res_type)\n resourcetypes.append((result.resource_type.slug, result.resource))\n except FeaturedResource.DoesNotExist:\n result = current_topic.resource_set.filter(resource_type=res_type).order_by('-rating_votes')\n if len(result) > 0:\n resourcetypes.append((result[0].resource_type.slug, result[0]))\n ctx['resourcetypes'] = SortedDict(resourcetypes)\n\n return render_to_response('resources/topic_home.html', ctx, context_instance=RequestContext(request))", "metadata": "root.topic_home", "header": "['module', '___EOS___']", "index": 124 }, { "content": "class ResourceTopicListView(SetHeadlineMixin, SidebarMixin, ListView):\n context_object_name = 'resources'\n template_name = 'resources/resource_list.html'\n paginate_by = 12\n\n", "metadata": "root.ResourceTopicListView", "header": "['module', '___EOS___']", "index": 150 }, { "content": " def get_queryset(self):\n level_to_get = None\n res_type = None\n slug = self.kwargs['slug']\n try:\n res_type = self.kwargs['res_type']\n except KeyError:\n pass\n if 'level' in self.request.GET:\n level_to_get = self.request.GET['level']\n topic = get_object_or_404(Topic, slug=slug)\n resources = topic.resource_set.all()\n self.headline = 'All ' + unicode(topic.name).capitalize() +' Resources'\n if res_type:\n res_type = get_object_or_404(ResourceType, slug=res_type)\n resources = resources.filter(resource_type=res_type)\n self.headline = unicode(topic.name).capitalize() +' Resources' + ' (' + unicode(res_type.name) + 's)'\n if level_to_get and level_to_get != 'all':\n resources = resources.filter(level=level_to_get)\n return resources", "metadata": "root.ResourceTopicListView.get_queryset", "header": "['class', 'ResourceTopicListView', '(', 'SetHeadlineMixin', ',', 'SidebarMixin', ',', 'ListView', ')', ':', '___EOS___']", "index": 155 }, { "content": " def get_context_data(self, **kwargs):\n context = super(ResourceTopicListView, self).get_context_data(**kwargs)\n topic = get_object_or_404(Topic, slug=self.kwargs['slug'])\n context['current_topic'] = topic\n return context", "metadata": "root.ResourceTopicListView.get_context_data", "header": "['class', 'ResourceTopicListView', '(', 'SetHeadlineMixin', ',', 'SidebarMixin', ',', 'ListView', ')', ':', '___EOS___']", "index": 176 }, { "content": "class ResourceDetailView(SetHeadlineMixin, SidebarMixin, DetailView):\n model = Resource\n context_object_name = 'resource'\n template_name = 'resources/resource_detail.html'\n\n", "metadata": "root.ResourceDetailView", "header": "['module', '___EOS___']", "index": 183 }, { "content": " def get_object(self):\n resource = super(ResourceDetailView, self).get_object()\n self.headline = unicode(resource.title) + \"\"\" (\"\"\" + unicode(resource.resource_type) + \"\"\") | Resource\"\"\"\n return resource", "metadata": "root.ResourceDetailView.get_object", "header": "['class', 'ResourceDetailView', '(', 'SetHeadlineMixin', ',', 'SidebarMixin', ',', 'DetailView', ')', ':', '___EOS___']", "index": 188 }, { "content": " def get_context_data(self, **kwargs):\n context = super(ResourceDetailView, self).get_context_data(**kwargs)\n return context", "metadata": "root.ResourceDetailView.get_context_data", "header": "['class', 'ResourceDetailView', '(', 'SetHeadlineMixin', ',', 'SidebarMixin', ',', 'DetailView', ')', ':', '___EOS___']", "index": 193 }, { "content": "class ResourceCreateView(LoginRequiredMixin, SetHeadlineMixin, SidebarMixin, CreateView):\n form_class = ResourceCreateForm\n model = Resource\n headline = 'Add new Resource'\n", "metadata": "root.ResourceCreateView", "header": "['module', '___EOS___']", "index": 198 }, { "content": " def form_valid(self, form):\n form.instance.created_by = self.request.user\n return super(ResourceCreateView, self).form_valid(form)", "metadata": "root.ResourceCreateView.form_valid", "header": "['class', 'ResourceCreateView', '(', 'LoginRequiredMixin', ',', 'SetHeadlineMixin', ',', 'SidebarMixin', ',', 'CreateView', ')', ':', '___EOS___']", "index": 203 }, { "content": "class ResourceUpdateView(LoginRequiredMixin, PermissionRequiredMixin, SetHeadlineMixin, SidebarMixin, UpdateView):\n form_class = ResourceUpdateForm\n model = Resource\n headline = 'Edit Resource'\n permission_required = 'resources.change_resource'\n return_403 = True", "metadata": "root.ResourceUpdateView", "header": "['module', '___EOS___']", "index": 208 }, { "content": "class TopicCreateView(SetHeadlineMixin, SidebarMixin, CreateView):\n form_class = TopicCreateForm\n template_name = 'resources/topic_form.html'\n permission_required = 'resources.add_topic'\n headline = 'Create New Topic'", "metadata": "root.TopicCreateView", "header": "['module', '___EOS___']", "index": 216 }, { "content": "class TopicUpdateView(PermissionRequiredMixin, SetHeadlineMixin, SidebarMixin, UpdateView):\n form_class = TopicUpdateForm\n model = Topic\n template_name = 'resources/topic_form.html'\n permission_required = 'resources.change_topic'\n render_403 = True\n return_403 = True\n headline = 'Edit Topic'", "metadata": "root.TopicUpdateView", "header": "['module', '___EOS___']", "index": 223 } ]
[ { "span": "from django.core.exceptions import ObjectDoesNotExist", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 53 }, { "span": "from django.core.urlresolvers import reverse_lazy, reverse", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 58 }, { "span": "from django.http import HttpResponse, HttpResponseRedirect, Http404", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 67 }, { "span": "from django.views.generic import TemplateView, ListView, DetailView, CreateView, UpdateView, RedirectView", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 105 }, { "span": "from django.contrib.auth.models import User", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 43 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "exceptions_", "import_", "Object", "Do", "es", "Not", "Exist_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "shortcuts_", "import_", "get", "\\u", "object\\u", "or", "\\u", "404_", ",_", "render", "\\u", "to", "\\u", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "urlresolvers_", "import_", "reverse", "\\u", "lazy_", ",_", "reverse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "import_", "messages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "datastr", "ucture", "s_", "import_", "Sorte", "d", "Dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "http_", "import_", "Http", "Response_", ",_", "Http", "Respons", "e", "Redirect_", ",_", "Http404_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "template_", "import_", "Request", "Context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "views_", "._", "generic_", "import_", "Templa", "te", "View_", ",_", "List", "View_", ",_", "Det", "ail", "View_", ",_", "Creat", "e", "View_", ",_", "Update", "View_", ",_", "Redirect", "View_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "guard", "ian_", "._", "mixins_", "import_", "Logi", "n", "Requ", "ired", "Mixin_", ",_", "Permi", "ssion", "Requ", "ired", "Mixin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "braces", "_", "._", "views_", "import_", "Set", "Head", "line", "Mixin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django", "ratings_", "._", "views_", "import_", "Add", "Rati", "ng", "View_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "models_", "import_", "User_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "contenttype", "s_", "._", "models_", "import_", "Conten", "t", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "models_", "import_", "Resource_", ",_", "Topic_", ",_", "Reso", "urc", "e", "Type_", ",_", "Feature", "d", "Resource_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "profiles_", "._", "models_", "import_", "Save", "d", "Resource_", ",_", "Topic", "Follow", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "forms_", "import_", "Reso", "urc", "e", "Creat", "e", "Form_", ",_", "Reso", "urc", "e", "Update", "Form_", ",_", "Topic", "Creat", "e", "Form_", ",_", "Topic", "Update", "Form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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\\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_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "resource", "\\u", "home_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "topics_", "=_", "Topic_", "._", "objects_", "._", "filter_", "(_", "resource", "\\u\\u", "title\\u\\u", "isnull_", "=_", "False_", ")_", "._", "distinct_", "(_", ")_", "._", "order", "\\u", "by_", "(_", "'", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Check", " ", "vari", "ous", " ", "session", " ", "values", " ", "for", " ", "user", " ", "deta", "il", "s", " ", "and", " ", "show", " ", "appropr", "iate", " ", "info_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "request", ".", "session", ".", "get", "('", "no", "\\u", "name", "',", " ", "Fal", "se", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "message", "s", ".", "info", "(", "request", ",", " ", "'", "Ple", "ase", " ", "fill", " ", "in", " ", "your", " ", "profile", " ", "deta", "il", "s", " ", "by", " ", "goi", "ng", " ", "to", " ", "your", " ", "account", " ", "settings", ".'", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "request", ".", "session", "['", "no", "\\u", "name", "']", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "request_", "._", "session_", "._", "get_", "(_", "'", "no", "\\u", "topic", "'_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "messages_", "._", "warning_", "(_", "request_", ",_", "'", "It", " ", "see", "ms", " ", "you", " ", "are", " ", "not", " ", "follow", "ing", " ", "any", " ", "topic", ".", " ", "Follow", " ", "topic", "s", " ", "by", " ", "click", "ing", " ", "on", " ", "it", " ", "belo", "w", " ", "and", " ", "get", " ", "personali", "zed", " ", "recommendations", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "session_", "[_", "'", "no", "\\u", "topic", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ctx_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "topic", "s", "'_", ":_", "topics_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "'", "resource", "s", "/", "resource", "\\u", "home", ".", "html", "'_", ",_", "ctx_", ",_", "context", "\\u", "instance_", "=_", "Request", "Context_", "(_", "request_", ")_", ")_", "\\u\\u\\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_", "rate", "\\u", "resource_", "(_", "request_", ",_", "object\\u", "id_", ",_", "score_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "'", "resource", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app", "\\u", "label_", "=_", "'", "resource", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field", "\\u", "name_", "=_", "'", "rati", "ng", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "content", "\\u", "type_", "=_", "Conten", "t", "Type_", "._", "objects_", "._", "get_", "(_", "model_", "=_", "model_", ",_", "app", "\\u", "label_", "=_", "app", "\\u", "label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Conten", "t", "Type_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Http404_", "(_", "'", "Inva", "lid", " ", "`", "model", "`", " ", "or", " ", "`", "app", "\\u", "label", "`.", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "params_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "\\u", "type", "\\u", "id", "'_", ":_", "content", "\\u", "type_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "object\\u", "id", "'_", ":_", "object\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "field", "\\u", "name", "'_", ":_", "field", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "score", "'_", ":_", "score_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "Add", "Rati", "ng", "View_", "(_", ")_", "(_", "request_", ",_", "**_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "response_", "._", "status", "\\u", "code_", "==_", "200_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "response_", "._", "content_", "==_", "'", "Vote", " ", "recorde", "d", ".'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "messages_", "._", "success_", "(_", "request_", ",_", "'", "Thanks", ",", " ", "You", "r", " ", "Vote", " ", "is", " ", "recorde", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "messages_", "._", "error_", "(_", "request_", ",_", "'", "So", "rr", "y", ",", " ", "Some", "thing", " ", "wen", "t", " ", "wrong", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "request_", "._", "META_", "[_", "'", "HTTP", "\\u", "REFE", "RER", "'_", "]_", ")_", "\\u\\u\\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_", "Reso", "urc", "e", "Save", "View_", "(_", "Logi", "n", "Requ", "ired", "Mixin_", ",_", "Redirect", "View_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "permanent", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "Save", "View_", "(_", "Logi", "n", "Requ", "ired", "Mixin_", ",_", "Redirect", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "redirec", "t", "\\u", "url_", "(_", "self_", ",_", "pk_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resource_", "=_", "get", "\\u", "object\\u", "or", "\\u", "404_", "(_", "Resource_", ",_", "pk_", "=_", "pk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Save", "d", "Resource_", "._", "objects_", "._", "get", "\\u", "or", "\\u", "create_", "(_", "user_", "=_", "self_", "._", "request_", "._", "user_", ",_", "resource_", "=_", "resource_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "request_", "._", "META_", "[_", "'", "HTTP", "\\u", "REFE", "RER", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "request_", "._", "META_", "[_", "'", "HTTP", "\\u", "REFE", "RER", "'_", "]_", "\\u\\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_", "reverse", "\\u", "lazy_", "(_", "'", "resource", "\\u", "deta", "il", "'_", ",_", "kwargs_", "=_", "{_", "'", "pk", "'_", ":_", "pk_", "}_", ")_", "\\u\\u\\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_", "Reso", "urc", "e", "Feature", "View_", "(_", "Logi", "n", "Requ", "ired", "Mixin_", ",_", "Redirect", "View_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "permanent", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "permissi", "on", "\\u", "required_", "=_", "'", "resource", "s", ".", "change", "\\u", "feature", "dre", "source", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return", "\\u", "403_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "Feature", "View_", "(_", "Logi", "n", "Requ", "ired", "Mixin_", ",_", "Redirect", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "redirec", "t", "\\u", "url_", "(_", "self_", ",_", "pk_", ",_", "slug_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resource_", "=_", "get", "\\u", "object\\u", "or", "\\u", "404_", "(_", "Resource_", ",_", "pk_", "=_", "pk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "topic_", "=_", "get", "\\u", "object\\u", "or", "\\u", "404_", "(_", "Topic_", ",_", "slug_", "=_", "slug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resource_", "._", "make", "\\u", "feature", "d_", "(_", "topic_", "=_", "topic_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "request_", "._", "META_", "[_", "'", "HTTP", "\\u", "REFE", "RER", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "request_", "._", "META_", "[_", "'", "HTTP", "\\u", "REFE", "RER", "'_", "]_", "\\u\\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_", "reverse", "\\u", "lazy_", "(_", "'", "resource", "\\u", "deta", "il", "'_", ",_", "kwargs_", "=_", "{_", "'", "pk", "'_", ":_", "pk_", "}_", ")_", "\\u\\u\\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_", "Side", "bar", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Side", "bar", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get", "\\u", "context", "\\u", "data_", "(_", "self_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "super_", "(_", "Side", "bar", "Mixin_", ",_", "self_", ")_", "._", "get", "\\u", "context", "\\u", "data_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "topics_", "=_", "Topic_", "._", "objects_", "._", "filter_", "(_", "resource", "\\u\\u", "title\\u\\u", "isnull_", "=_", "False_", ")_", "._", "distinct_", "(_", ")_", "._", "order", "\\u", "by_", "(_", "'", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "'", "topic", "s", "'_", "]_", "=_", "topics_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Reso", "urc", "e", "All", "List", "View_", "(_", "Set", "Head", "line", "Mixin_", ",_", "Side", "bar", "Mixin_", ",_", "List", "View_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context", "\\u", "object\\u", "name_", "=_", "'", "resource", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "template", "\\u", "name_", "=_", "'", "resource", "s", "/", "resource", "\\u", "list", ".", "html", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "paginate", "\\u", "by_", "=_", "12_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "All", "List", "View_", "(_", "Set", "Head", "line", "Mixin_", ",_", "Side", "bar", "Mixin_", ",_", "List", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "queryset_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "level", "\\u", "to", "\\u", "get_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "level", "'_", "in_", "self_", "._", "request_", "._", "GET_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "level", "\\u", "to", "\\u", "get_", "=_", "self_", "._", "request_", "._", "GET_", "[_", "'", "level", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "resources_", "=_", "Resource_", "._", "objects_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "level", "\\u", "to", "\\u", "get_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resources_", "=_", "resources_", "._", "filter_", "(_", "level_", "=_", "level", "\\u", "to", "\\u", "get_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "headline", "_", "=_", "'", "All", " ", "Reso", "urc", "es", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "resources_", "\\u\\u\\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_", "Topic", "Follow", "View_", "(_", "Logi", "n", "Requ", "ired", "Mixin_", ",_", "Redirect", "View_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "permanent", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Topic", "Follow", "View_", "(_", "Logi", "n", "Requ", "ired", "Mixin_", ",_", "Redirect", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "redirec", "t", "\\u", "url_", "(_", "self_", ",_", "slug_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "topic_", "=_", "get", "\\u", "object\\u", "or", "\\u", "404_", "(_", "Topic_", ",_", "slug_", "=_", "slug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tf_", "=_", "Topic", "Follow", "_", "._", "objects_", "._", "get_", "(_", "user_", "=_", "self_", "._", "request_", "._", "user_", ",_", "topic_", "=_", "topic_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tf_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "messages_", "._", "success_", "(_", "self_", "._", "request_", ",_", "'", "You", " ", "have", " ", "stopp", "ed", " ", "follow", "ing", " ", "this", " ", "topic", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Topic", "Follow", "_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Topic", "Follow", "_", "._", "objects_", "._", "create_", "(_", "user_", "=_", "self_", "._", "request_", "._", "user_", ",_", "topic_", "=_", "topic_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "messages_", "._", "success_", "(_", "self_", "._", "request_", ",_", "'", "You", " ", "are", " ", "now", " ", "follow", "ing", " ", "this", " ", "topic", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "reverse", "\\u", "lazy_", "(_", "'", "resource", "\\u", "topic", "\\u", "home", "'_", ",_", "kwargs_", "=_", "{_", "'", "slug", "'_", ":_", "slug_", "}_", ")_", "\\u\\u\\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_", "topic", "\\u", "home_", "(_", "request_", ",_", "slug_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "current", "\\u", "topic_", "=_", "get", "\\u", "object\\u", "or", "\\u", "404_", "(_", "Topic_", ",_", "slug_", "=_", "slug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headline", "_", "=_", "\"\"\"", "Learn", " ", "\"\"\"_", "+_", "unicode_", "(_", "current", "\\u", "topic_", "._", "name_", ")_", "._", "capitalize_", "(_", ")_", "+_", "\"\"\"", " ", "-", " ", "from", " ", "the", " ", "best", " ", "tutorial", "s", " ", "and", " ", "onli", "ne", " ", "course", "s", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "topics_", "=_", "Topic_", "._", "objects_", "._", "filter_", "(_", "resource", "\\u\\u", "title\\u\\u", "isnull_", "=_", "False_", ")_", "._", "distinct_", "(_", ")_", "._", "order", "\\u", "by_", "(_", "'", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ctx_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "current", "\\u", "topic", "'_", ":_", "current", "\\u", "topic_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "headline", "'_", ":_", "headline", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "topic", "s", "'_", ":_", "topics_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resource", "types_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res", "\\u", "types_", "=_", "Reso", "urc", "e", "Type_", "._", "objects_", "._", "all_", "(_", ")_", "._", "order", "\\u", "by_", "(_", "'", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "res", "\\u", "type_", "in_", "res", "\\u", "types_", ":_", "\\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_", "=_", "Feature", "d", "Resource_", "._", "objects_", "._", "get_", "(_", "topic_", "=_", "current", "\\u", "topic_", ",_", "resource", "\\u", "type_", "=_", "res", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resource", "types_", "._", "append_", "(_", "(_", "result_", "._", "resource", "\\u", "type_", "._", "slug_", ",_", "result_", "._", "resource_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Feature", "d", "Resource_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "current", "\\u", "topic_", "._", "resource", "\\u", "set_", "._", "filter_", "(_", "resource", "\\u", "type_", "=_", "res", "\\u", "type_", ")_", "._", "order", "\\u", "by_", "(_", "'-", "rati", "ng", "\\u", "vote", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "result_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resource", "types_", "._", "append_", "(_", "(_", "result_", "[_", "0_", "]_", "._", "resource", "\\u", "type_", "._", "slug_", ",_", "result_", "[_", "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_", "ctx_", "[_", "'", "resource", "types", "'_", "]_", "=_", "Sorte", "d", "Dict_", "(_", "resource", "types_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "'", "resource", "s", "/", "topic", "\\u", "home", ".", "html", "'_", ",_", "ctx_", ",_", "context", "\\u", "instance_", "=_", "Request", "Context_", "(_", "request_", ")_", ")_", "\\u\\u\\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_", "Reso", "urc", "e", "Topic", "List", "View_", "(_", "Set", "Head", "line", "Mixin_", ",_", "Side", "bar", "Mixin_", ",_", "List", "View_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context", "\\u", "object\\u", "name_", "=_", "'", "resource", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "template", "\\u", "name_", "=_", "'", "resource", "s", "/", "resource", "\\u", "list", ".", "html", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "paginate", "\\u", "by_", "=_", "12_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "Topic", "List", "View_", "(_", "Set", "Head", "line", "Mixin_", ",_", "Side", "bar", "Mixin_", ",_", "List", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "queryset_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "level", "\\u", "to", "\\u", "get_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res", "\\u", "type_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slug_", "=_", "self_", "._", "kwargs_", "[_", "'", "slug", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res", "\\u", "type_", "=_", "self_", "._", "kwargs_", "[_", "'", "res", "\\u", "type", "'_", "]_", "\\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 ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "level", "'_", "in_", "self_", "._", "request_", "._", "GET_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "level", "\\u", "to", "\\u", "get_", "=_", "self_", "._", "request_", "._", "GET_", "[_", "'", "level", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "topic_", "=_", "get", "\\u", "object\\u", "or", "\\u", "404_", "(_", "Topic_", ",_", "slug_", "=_", "slug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resources_", "=_", "topic_", "._", "resource", "\\u", "set_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "headline", "_", "=_", "'", "All", " ", "'_", "+_", "unicode_", "(_", "topic_", "._", "name_", ")_", "._", "capitalize_", "(_", ")_", "+_", "'", " ", "Reso", "urc", "es", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "res", "\\u", "type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res", "\\u", "type_", "=_", "get", "\\u", "object\\u", "or", "\\u", "404_", "(_", "Reso", "urc", "e", "Type_", ",_", "slug_", "=_", "res", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resources_", "=_", "resources_", "._", "filter_", "(_", "resource", "\\u", "type_", "=_", "res", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "headline", "_", "=_", "unicode_", "(_", "topic_", "._", "name_", ")_", "._", "capitalize_", "(_", ")_", "+_", "'", " ", "Reso", "urc", "es", "'_", "+_", "'", " ", "('_", "+_", "unicode_", "(_", "res", "\\u", "type_", "._", "name_", ")_", "+_", "'", "s", ")'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "level", "\\u", "to", "\\u", "get_", "and_", "level", "\\u", "to", "\\u", "get_", "!=_", "'", "all", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resources_", "=_", "resources_", "._", "filter_", "(_", "level_", "=_", "level", "\\u", "to", "\\u", "get_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "resources_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "Topic", "List", "View_", "(_", "Set", "Head", "line", "Mixin_", ",_", "Side", "bar", "Mixin_", ",_", "List", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "context", "\\u", "data_", "(_", "self_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "super_", "(_", "Reso", "urc", "e", "Topic", "List", "View_", ",_", "self_", ")_", "._", "get", "\\u", "context", "\\u", "data_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "topic_", "=_", "get", "\\u", "object\\u", "or", "\\u", "404_", "(_", "Topic_", ",_", "slug_", "=_", "self_", "._", "kwargs_", "[_", "'", "slug", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "'", "current", "\\u", "topic", "'_", "]_", "=_", "topic_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Reso", "urc", "e", "Det", "ail", "View_", "(_", "Set", "Head", "line", "Mixin_", ",_", "Side", "bar", "Mixin_", ",_", "Det", "ail", "View_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Resource_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context", "\\u", "object\\u", "name_", "=_", "'", "resource", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "template", "\\u", "name_", "=_", "'", "resource", "s", "/", "resource", "\\u", "deta", "il", ".", "html", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "Det", "ail", "View_", "(_", "Set", "Head", "line", "Mixin_", ",_", "Side", "bar", "Mixin_", ",_", "Det", "ail", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "object_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resource_", "=_", "super_", "(_", "Reso", "urc", "e", "Det", "ail", "View_", ",_", "self_", ")_", "._", "get", "\\u", "object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "headline", "_", "=_", "unicode_", "(_", "resource_", "._", "title_", ")_", "+_", "\"\"\"", " ", "(\"", "\"\"_", "+_", "unicode_", "(_", "resource_", "._", "resource", "\\u", "type_", ")_", "+_", "\"\"\"", ")", " ", "|", " ", "Reso", "urc", "e", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "resource_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "Det", "ail", "View_", "(_", "Set", "Head", "line", "Mixin_", ",_", "Side", "bar", "Mixin_", ",_", "Det", "ail", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "context", "\\u", "data_", "(_", "self_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "super_", "(_", "Reso", "urc", "e", "Det", "ail", "View_", ",_", "self_", ")_", "._", "get", "\\u", "context", "\\u", "data_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Reso", "urc", "e", "Creat", "e", "View_", "(_", "Logi", "n", "Requ", "ired", "Mixin_", ",_", "Set", "Head", "line", "Mixin_", ",_", "Side", "bar", "Mixin_", ",_", "Creat", "e", "View_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form", "\\u", "class_", "=_", "Reso", "urc", "e", "Creat", "e", "Form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "=_", "Resource_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headline", "_", "=_", "'", "Add", " ", "new", " ", "Reso", "urc", "e", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "Creat", "e", "View_", "(_", "Logi", "n", "Requ", "ired", "Mixin_", ",_", "Set", "Head", "line", "Mixin_", ",_", "Side", "bar", "Mixin_", ",_", "Creat", "e", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "form", "\\u", "valid_", "(_", "self_", ",_", "form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "._", "instance_", "._", "created", "\\u", "by_", "=_", "self_", "._", "request_", "._", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "super_", "(_", "Reso", "urc", "e", "Creat", "e", "View_", ",_", "self_", ")_", "._", "form", "\\u", "valid_", "(_", "form_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Reso", "urc", "e", "Update", "View_", "(_", "Logi", "n", "Requ", "ired", "Mixin_", ",_", "Permi", "ssion", "Requ", "ired", "Mixin_", ",_", "Set", "Head", "line", "Mixin_", ",_", "Side", "bar", "Mixin_", ",_", "Update", "View_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form", "\\u", "class_", "=_", "Reso", "urc", "e", "Update", "Form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "=_", "Resource_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headline", "_", "=_", "'", "Edit", " ", "Reso", "urc", "e", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "permissi", "on", "\\u", "required_", "=_", "'", "resource", "s", ".", "change", "\\u", "resource", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return", "\\u", "403_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Topic", "Creat", "e", "View_", "(_", "Set", "Head", "line", "Mixin_", ",_", "Side", "bar", "Mixin_", ",_", "Creat", "e", "View_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form", "\\u", "class_", "=_", "Topic", "Creat", "e", "Form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "template", "\\u", "name_", "=_", "'", "resource", "s", "/", "topic", "\\u", "form", ".", "html", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "permissi", "on", "\\u", "required_", "=_", "'", "resource", "s", ".", "add", "\\u", "topic", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headline", "_", "=_", "'", "Creat", "e", " ", "New", " ", "Topic", "'_", "\\u\\u\\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_", "Topic", "Update", "View_", "(_", "Permi", "ssion", "Requ", "ired", "Mixin_", ",_", "Set", "Head", "line", "Mixin_", ",_", "Side", "bar", "Mixin_", ",_", "Update", "View_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form", "\\u", "class_", "=_", "Topic", "Update", "Form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "=_", "Topic_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "template", "\\u", "name_", "=_", "'", "resource", "s", "/", "topic", "\\u", "form", ".", "html", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "permissi", "on", "\\u", "required_", "=_", "'", "resource", "s", ".", "change", "\\u", "topic", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "render", "\\u", "403_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return", "\\u", "403_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headline", "_", "=_", "'", "Edit", " ", "Topic", "'_" ]
[ 4, 4, 4, 4, 4, 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, 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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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 ]
Insecure temporary file
deanhiller/databus/webapp/play1.3.x/python/Lib/multiprocessing/connection.py
[ { "content": "def arbitrary_address(family):\n '''\n Return an arbitrary free address for the given family\n '''\n if family == 'AF_INET':\n return ('localhost', 0)\n elif family == 'AF_UNIX':\n return tempfile.mktemp(prefix='listener-', dir=get_temp_dir())\n elif family == 'AF_PIPE':\n return tempfile.mktemp(prefix=r'\\\\.\\pipe\\pyc-%d-%d-' %\n (os.getpid(), _mmap_counter.next()))\n else:\n raise ValueError('unrecognized family')", "metadata": "root.arbitrary_address", "header": "['module', '___EOS___']", "index": 47 } ]
[ { "span": "tempfile.mktemp(prefix='listener-', dir=get_temp_dir())", "start_line": 54, "start_column": 15, "end_line": 54, "end_column": 70 }, { "span": "tempfile.mktemp(prefix=r'\\\\.\\pipe\\pyc-%d-%d-' %\n (os.getpid(), _mmap_counter.next()))", "start_line": 56, "start_column": 15, "end_line": 57, "end_column": 67 } ]
[]
1
true
[ "[CLS]_", "Inse", "cure", "_", "temporar", "y_", "file_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "arbitra", "ry", "\\u", "address_", "(_", "family_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "an", " ", "arbitra", "ry", " ", "free", " ", "address", " ", "for", " ", "the", " ", "give", "n", " ", "famil", "y", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "family_", "==_", "'", "AF", "\\u", "INE", "T", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "'", "local", "host", "'_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "family_", "==_", "'", "AF", "\\u", "UNIX", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "tempfile_", "._", "mktemp_", "(_", "prefix_", "=_", "'", "listen", "er", "-'_", ",_", "dir_", "=_", "get", "\\u", "temp", "\\u", "dir_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "family_", "==_", "'", "AF", "\\u", "PIPE", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "tempfile_", "._", "mktemp_", "(_", "prefix_", "=_", "r", "'\\\\\\\\", ".\\\\", "pipe", "\\\\", "pyc", "-%", "d", "-%", "d", "-'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "os_", "._", "getpid_", "(_", ")_", ",_", "\\u", "mma", "p", "\\u", "counter_", "._", "next_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "unre", "cogni", "zed", " ", "famil", "y", "'_", ")_", "\\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, 0, 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, 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, 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'
lunixbochs/uberserver/tasserver/LegacyUsers.py
[ { "content": "import time, os\n\nimport traceback\ntry:\n\tfrom LegacyBans import BanHandler\nexcept:\n\tprint '-'*60\n\tprint traceback.format_exc()\n\tprint '-'*60\n\tprint 'Error importing LegacyBans. You might lack sqlalchemy, which you can get from running scripts/fetch_deps.py'\n\tBanHandler = None\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "\t@classmethod\n\tdef fromAccountLine(cls, line):\n\t\tline = line.split()\n\t\tif len(line) < 8: return\n\n\t\ttry:\n\t\t\tusername = line[0]\n\t\t\tpassword = line[1]\n\t\t\taccess = line[2]\n\t\t\tuid = line[3]\n\t\t\tlast_login = int(line[4])\n\t\t\tlast_ip = line[5]\n\t\t\tregister_date = int(line[6])\n\t\t\tcountry = line[7]\n\t\t\t# mapgrades = ' '.join(line[8:]) # no longer used\n\t\t\taccount_id = line[8]\n\t\t\t\n\t\t\tpermissions = int((access[-3:] or '0'), 2)\n\t\t\tingame_time = int((access[-23:-3] or '0'), 2)\n\t\t\tagreement = (len(access) >= 24 and access[-24] == '1')\n\t\t\tbot = (len(access) >= 25 and access[-25] == '1')\n\n\t\t\tif permissions and not agreement: access = 'agreement'\n\t\t\telif permissions == 3: access = 'admin'\n\t\t\telif permissions == 2: access = 'mod'\n\t\t\telif permissions == 1: access = 'user'\n\t\t\telse: access = 'disabled'\n\t\t\n\t\t\treturn cls(username, password, ingame_time, bot, access, uid, last_login, last_ip, register_date, country, account_id)\n\t\texcept:\n\t\t\tprint 'Error reading user:', line", "metadata": "root.User.fromAccountLine", "header": "['class', 'User', '(', 'object', ')', ':', '___EOS___']", "index": 26 } ]
[ { "span": "except:", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 7 }, { "span": "except:", "start_line": 55, "start_column": 2, "end_line": 55, "end_column": 9 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "time_", ",_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "from_", "Leg", "ac", "y", "Ban", "s_", "import_", "Ban", "Handler_", "\\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", "_", "print_", "'-'_", "*_", "60_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'-'_", "*_", "60_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "Error", " ", "import", "ing", " ", "Leg", "ac", "y", "Ban", "s", ".", " ", "You", " ", "mig", "ht", " ", "lack", " ", "sqla", "lche", "my", ",", " ", "whi", "ch", " ", "you", " ", "can", " ", "get", " ", "from", " ", "runn", "ing", " ", "scripts", "/", "fetch", "\\u", "dep", "s", ".", "py", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Ban", "Handler_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "[SEP]_", "class_", "User_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "from", "Account", "Line_", "(_", "cls_", ",_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "line_", "=_", "line_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "line_", ")_", "<_", "8_", ":_", "return_", "\\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\t", "\t\t_", "username_", "=_", "line_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "password_", "=_", "line_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "access_", "=_", "line_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uid_", "=_", "line_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "\\u", "login_", "=_", "int_", "(_", "line_", "[_", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "\\u", "ip_", "=_", "line_", "[_", "5_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "register", "\\u", "date_", "=_", "int_", "(_", "line_", "[_", "6_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "country_", "=_", "line_", "[_", "7_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "map", "grades", " ", "=", " ", "'", " ", "'.", "join", "(", "line", "[", "8", ":]", ")", " ", "#", " ", "no", " ", "long", "er", " ", "used_", "\\u\\u\\uNL\\u\\u\\u_", "account", "\\u", "id_", "=_", "line_", "[_", "8_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "permissions_", "=_", "int_", "(_", "(_", "access_", "[_", "-_", "3_", ":_", "]_", "or_", "'", "0", "'_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ing", "ame", "\\u", "time_", "=_", "int_", "(_", "(_", "access_", "[_", "-_", "23_", ":_", "-_", "3_", "]_", "or_", "'", "0", "'_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "agreement", "_", "=_", "(_", "len_", "(_", "access_", ")_", ">=_", "24_", "and_", "access_", "[_", "-_", "24_", "]_", "==_", "'", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bot_", "=_", "(_", "len_", "(_", "access_", ")_", ">=_", "25_", "and_", "access_", "[_", "-_", "25_", "]_", "==_", "'", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "permissions_", "and_", "not_", "agreement", "_", ":_", "access_", "=_", "'", "agreement", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "elif_", "permissions_", "==_", "3_", ":_", "access_", "=_", "'", "admin", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "elif_", "permissions_", "==_", "2_", ":_", "access_", "=_", "'", "mod", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "elif_", "permissions_", "==_", "1_", ":_", "access_", "=_", "'", "user", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "access_", "=_", "'", "disable", "d", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "cls_", "(_", "username_", ",_", "password_", ",_", "ing", "ame", "\\u", "time_", ",_", "bot_", ",_", "access_", ",_", "uid_", ",_", "last", "\\u", "login_", ",_", "last", "\\u", "ip_", ",_", "register", "\\u", "date_", ",_", "country_", ",_", "account", "\\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\t", "\t\t_", "print_", "'", "Error", " ", "readi", "ng", " ", "user", ":'_", ",_", "line_", "\\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, 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,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2, 2, 2 ]
Unused local variable
braintree/braintree_python/tests/integration/test_paypal_account.py
[ { "content": " def test_find_retuns_billing_agreement_id_with_a_paypal_account(self):\n customer_id = Customer.create().customer.id\n payment_method_token = \"paypal-account-\" + str(int(time.time()))\n\n result = PaymentMethod.create({\n \"payment_method_nonce\": Nonces.PayPalBillingAgreement,\n \"customer_id\": customer_id\n })\n self.assertTrue(result.is_success)\n\n paypal_account = PayPalAccount.find(result.payment_method.token)\n self.assertNotEquals(None, paypal_account.billing_agreement_id)", "metadata": "root.TestPayPalAccount.test_find_retuns_billing_agreement_id_with_a_paypal_account", "header": "['class', 'TestPayPalAccount', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 64 }, { "content": " def test_update_can_update_token_and_default(self):\n customer_id = Customer.create().customer.id\n\n credit_card = CreditCard.create({\n \"customer_id\": customer_id,\n \"number\": \"4111111111111111\",\n \"expiration_date\": \"12/2099\"\n }).credit_card\n\n result = PaymentMethod.create({\n \"customer_id\": customer_id,\n \"payment_method_nonce\": Nonces.PayPalFuturePayment\n })\n self.assertTrue(result.is_success)\n\n old_token = result.payment_method.token\n new_token = \"new-token-%s\" % int(round(time.time() * 1000))\n result = PayPalAccount.update(old_token, {\n \"token\": new_token,\n \"options\": {\"make_default\": True}\n })\n\n self.assertTrue(result.is_success)\n updated_account = PayPalAccount.find(new_token)\n self.assertEquals(updated_account.default, True)", "metadata": "root.TestPayPalAccount.test_update_can_update_token_and_default", "header": "['class', 'TestPayPalAccount', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 102 }, { "content": " def test_update_returns_validation_errors(self):\n payment_method_token = \"payment-token-%s\" % int(round(time.time() * 1000))\n customer_id = Customer.create().customer.id\n credit_card = CreditCard.create({\n \"token\": payment_method_token,\n \"customer_id\": customer_id,\n \"number\": \"4111111111111111\",\n \"expiration_date\": \"12/2099\"\n }).credit_card\n\n result = PaymentMethod.create({\n \"customer_id\": customer_id,\n \"payment_method_nonce\": Nonces.PayPalFuturePayment\n })\n self.assertTrue(result.is_success)\n\n old_token = result.payment_method.token\n result = PayPalAccount.update(old_token, {\n \"token\": payment_method_token,\n })\n\n self.assertFalse(result.is_success)\n self.assertEquals(\n ErrorCodes.PayPalAccount.TokenIsInUse,\n result.errors.for_object(\"paypal_account\").on(\"token\")[0].code\n )\n\n result = PayPalAccount.update(old_token, {\n \"token\": payment_method_token,\n })\n\n self.assertFalse(result.is_success)\n self.assertEquals(\n ErrorCodes.PayPalAccount.TokenIsInUse,\n result.errors.for_object(\"paypal_account\").on(\"token\")[0].code\n )", "metadata": "root.TestPayPalAccount.test_update_returns_validation_errors", "header": "['class', 'TestPayPalAccount', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 128 } ]
[ { "span": "payment_method_token ", "start_line": 66, "start_column": 8, "end_line": 66, "end_column": 28 }, { "span": "credit_card ", "start_line": 105, "start_column": 8, "end_line": 105, "end_column": 19 }, { "span": "credit_card ", "start_line": 131, "start_column": 8, "end_line": 131, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "Pay", "Pal", "Account_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "find", "\\u", "ret", "uns", "\\u", "bill", "ing", "\\u", "agreement", "\\u", "id", "\\u", "with", "\\u", "a", "\\u", "paypal", "\\u", "account_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "customer", "\\u", "id_", "=_", "Customer_", "._", "create_", "(_", ")_", "._", "customer_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pay", "ment", "\\u", "method", "\\u", "token_", "=_", "\"", "paypal", "-", "account", "-\"_", "+_", "str_", "(_", "int_", "(_", "time_", "._", "time_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "Payment", "Method_", "._", "create_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pay", "ment", "\\u", "method", "\\u", "nonc", "e", "\"_", ":_", "Non", "ces_", "._", "Pay", "Pal", "Bill", "ing", "Agreement", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "customer", "\\u", "id", "\"_", ":_", "customer", "\\u", "id_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "result_", "._", "is", "\\u", "success_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "paypal", "\\u", "account_", "=_", "Pay", "Pal", "Account_", "._", "find_", "(_", "result_", "._", "pay", "ment", "\\u", "method_", "._", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equals_", "(_", "None_", ",_", "paypal", "\\u", "account_", "._", "bill", "ing", "\\u", "agreement", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Pay", "Pal", "Account_", "(_", "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", "can", "\\u", "update", "\\u", "token", "\\u", "and", "\\u", "default_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "customer", "\\u", "id_", "=_", "Customer_", "._", "create_", "(_", ")_", "._", "customer_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "credit", "\\u", "card_", "=_", "Credit", "Card_", "._", "create_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "customer", "\\u", "id", "\"_", ":_", "customer", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "number", "\"_", ":_", "\"", "411", "11111111111", "11", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "expir", "ation", "\\u", "date", "\"_", ":_", "\"", "1", "2", "/", "209", "9", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "._", "credit", "\\u", "card_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "Payment", "Method_", "._", "create_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "customer", "\\u", "id", "\"_", ":_", "customer", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pay", "ment", "\\u", "method", "\\u", "nonc", "e", "\"_", ":_", "Non", "ces_", "._", "Pay", "Pal", "Fu", "ture", "Payment", "_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "result_", "._", "is", "\\u", "success_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "old", "\\u", "token_", "=_", "result_", "._", "pay", "ment", "\\u", "method_", "._", "token_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "token_", "=_", "\"", "new", "-", "token", "-%", "s", "\"_", "%_", "int_", "(_", "round_", "(_", "time_", "._", "time_", "(_", ")_", "*_", "1000_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "Pay", "Pal", "Account_", "._", "update_", "(_", "old", "\\u", "token_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "token", "\"_", ":_", "new", "\\u", "token_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "options", "\"_", ":_", "{_", "\"", "make", "\\u", "default", "\"_", ":_", "True_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "result_", "._", "is", "\\u", "success_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "d\\u", "account_", "=_", "Pay", "Pal", "Account_", "._", "find_", "(_", "new", "\\u", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "update", "d\\u", "account_", "._", "default_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Pay", "Pal", "Account_", "(_", "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", "return", "s", "\\u", "validation", "\\u", "errors_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pay", "ment", "\\u", "method", "\\u", "token_", "=_", "\"", "pay", "ment", "-", "token", "-%", "s", "\"_", "%_", "int_", "(_", "round_", "(_", "time_", "._", "time_", "(_", ")_", "*_", "1000_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "customer", "\\u", "id_", "=_", "Customer_", "._", "create_", "(_", ")_", "._", "customer_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "credit", "\\u", "card_", "=_", "Credit", "Card_", "._", "create_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "token", "\"_", ":_", "pay", "ment", "\\u", "method", "\\u", "token_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "customer", "\\u", "id", "\"_", ":_", "customer", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "number", "\"_", ":_", "\"", "411", "11111111111", "11", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "expir", "ation", "\\u", "date", "\"_", ":_", "\"", "1", "2", "/", "209", "9", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "._", "credit", "\\u", "card_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "Payment", "Method_", "._", "create_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "customer", "\\u", "id", "\"_", ":_", "customer", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pay", "ment", "\\u", "method", "\\u", "nonc", "e", "\"_", ":_", "Non", "ces_", "._", "Pay", "Pal", "Fu", "ture", "Payment", "_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "result_", "._", "is", "\\u", "success_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "old", "\\u", "token_", "=_", "result_", "._", "pay", "ment", "\\u", "method_", "._", "token_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "Pay", "Pal", "Account_", "._", "update_", "(_", "old", "\\u", "token_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "token", "\"_", ":_", "pay", "ment", "\\u", "method", "\\u", "token_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "result_", "._", "is", "\\u", "success_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Error", "Codes_", "._", "Pay", "Pal", "Account_", "._", "Token", "Is", "In", "Use_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "._", "errors_", "._", "for", "\\u", "object_", "(_", "\"", "paypal", "\\u", "account", "\"_", ")_", "._", "on_", "(_", "\"", "token", "\"_", ")_", "[_", "0_", "]_", "._", "code_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "Pay", "Pal", "Account_", "._", "update_", "(_", "old", "\\u", "token_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "token", "\"_", ":_", "pay", "ment", "\\u", "method", "\\u", "token_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "result_", "._", "is", "\\u", "success_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Error", "Codes_", "._", "Pay", "Pal", "Account_", "._", "Token", "Is", "In", "Use_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "._", "errors_", "._", "for", "\\u", "object_", "(_", "\"", "paypal", "\\u", "account", "\"_", ")_", "._", "on_", "(_", "\"", "token", "\"_", ")_", "[_", "0_", "]_", "._", "code_", "\\u\\u\\uNL\\u\\u\\u_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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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 ]
Suspicious unused loop iteration variable
azoft-dev-team/imagrium/env/Lib/test/test_complex.py
[ { "content": " def test_subclass(self):\n class xcomplex(complex):\n def __add__(self,other):\n return xcomplex(complex(self) + other)\n __radd__ = __add__\n\n def __sub__(self,other):\n return xcomplex(complex(self) + other)\n __rsub__ = __sub__\n\n def __mul__(self,other):\n return xcomplex(complex(self) * other)\n __rmul__ = __mul__\n\n def __div__(self,other):\n return xcomplex(complex(self) / other)\n\n def __rdiv__(self,other):\n return xcomplex(other / complex(self))\n\n __truediv__ = __div__\n __rtruediv__ = __rdiv__\n\n def __floordiv__(self,other):\n return xcomplex(complex(self) // other)\n\n def __rfloordiv__(self,other):\n return xcomplex(other // complex(self))\n\n def __pow__(self,other):\n return xcomplex(complex(self) ** other)\n\n def __rpow__(self,other):\n return xcomplex(other ** complex(self) )\n\n def __mod__(self,other):\n return xcomplex(complex(self) % other)\n\n def __rmod__(self,other):\n return xcomplex(other % complex(self))\n\n infix_binops = ('+', '-', '*', '**', '%', '//', '/')\n xcomplex_values = (xcomplex(1), xcomplex(123.0),\n xcomplex(-10+2j), xcomplex(3+187j),\n xcomplex(3-78j))\n test_values = (1, 123.0, 10-19j, xcomplex(1+2j),\n xcomplex(1+87j), xcomplex(10+90j))\n\n for op in infix_binops:\n for x in xcomplex_values:\n for y in test_values:\n a = 'x %s y' % op\n b = 'y %s x' % op\n self.assertTrue(type(eval(a)) is type(eval(b)) is xcomplex)", "metadata": "root.ComplexTest.test_subclass", "header": "['class', 'ComplexTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 394 } ]
[ { "span": "for x in xcomplex_values:", "start_line": 443, "start_column": 12, "end_line": 443, "end_column": 37 }, { "span": "for y in test_values:", "start_line": 444, "start_column": 16, "end_line": 444, "end_column": 37 } ]
[]
1
true
[ "[CLS]_", "Sus", "picio", "us_", "unused_", "loop_", "iteration_", "variable_", "[SEP]_", "class_", "Comple", "x", "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", "subclass_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "xco", "mple", "x_", "(_", "complex_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "add\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "xco", "mple", "x_", "(_", "complex_", "(_", "self_", ")_", "+_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u", "rad", "d\\u\\u_", "=_", "\\u\\u", "add\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "sub\\u", "\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "xco", "mple", "x_", "(_", "complex_", "(_", "self_", ")_", "+_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u", "rsu", "b", "\\u\\u_", "=_", "\\u\\u", "sub\\u", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "mul\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "xco", "mple", "x_", "(_", "complex_", "(_", "self_", ")_", "*_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u", "rm", "ul", "\\u\\u_", "=_", "\\u\\u", "mul\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "div\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "xco", "mple", "x_", "(_", "complex_", "(_", "self_", ")_", "/_", "other_", ")_", "\\u\\u\\uNEWLINE\\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_", "xco", "mple", "x_", "(_", "other_", "/_", "complex_", "(_", "self_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u", "true", "div\\u\\u_", "=_", "\\u\\u", "div\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "rtr", "ued", "iv", "\\u\\u_", "=_", "\\u\\u", "rdi", "v", "\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "floor", "div\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "xco", "mple", "x_", "(_", "complex_", "(_", "self_", ")_", "//_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "rfl", "oor", "div\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "xco", "mple", "x_", "(_", "other_", "//_", "complex_", "(_", "self_", ")_", ")_", "\\u\\u\\uNEWLINE\\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_", "xco", "mple", "x_", "(_", "complex_", "(_", "self_", ")_", "**_", "other_", ")_", "\\u\\u\\uNEWLINE\\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_", "xco", "mple", "x_", "(_", "other_", "**_", "complex_", "(_", "self_", ")_", ")_", "\\u\\u\\uNEWLINE\\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_", "xco", "mple", "x_", "(_", "complex_", "(_", "self_", ")_", "%_", "other_", ")_", "\\u\\u\\uNEWLINE\\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_", "xco", "mple", "x_", "(_", "other_", "%_", "complex_", "(_", "self_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "infix", "\\u", "bino", "ps_", "=_", "(_", "'+'_", ",_", "'-'_", ",_", "'*'_", ",_", "'**", "'_", ",_", "'%'_", ",_", "'//'_", ",_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xco", "mple", "x", "\\u", "values_", "=_", "(_", "xco", "mple", "x_", "(_", "1_", ")_", ",_", "xco", "mple", "x_", "(_", "123.", "0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "xco", "mple", "x_", "(_", "-_", "10_", "+_", "2j", "_", ")_", ",_", "xco", "mple", "x_", "(_", "3_", "+_", "187", "j_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "xco", "mple", "x_", "(_", "3_", "-_", "7", "8", "j_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "values_", "=_", "(_", "1_", ",_", "123.", "0_", ",_", "10_", "-_", "1", "9", "j_", ",_", "xco", "mple", "x_", "(_", "1_", "+_", "2j", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "xco", "mple", "x_", "(_", "1_", "+_", "87", "j_", ")_", ",_", "xco", "mple", "x_", "(_", "10_", "+_", "90", "j_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "op_", "in_", "infix", "\\u", "bino", "ps_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "x_", "in_", "xco", "mple", "x", "\\u", "values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "y_", "in_", "test\\u", "values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "a_", "=_", "'", "x", " ", "%", "s", " ", "y", "'_", "%_", "op_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "'", "y", " ", "%", "s", " ", "x", "'_", "%_", "op_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "type_", "(_", "eval_", "(_", "a_", ")_", ")_", "is_", "type_", "(_", "eval_", "(_", "b_", ")_", ")_", "is_", "xco", "mple", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
django-oscar/django-oscar/src/oscar/apps/customer/migrations/0002_auto_20150807_1725.py
[ { "content": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\nimport oscar.models.fields.autoslugfield\nimport django.core.validators\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Migration(migrations.Migration):\n\n dependencies = [\n ('customer', '0001_initial'),\n ]\n\n operations = [\n migrations.AlterField(\n model_name='communicationeventtype',\n name='code',\n field=oscar.models.fields.autoslugfield.AutoSlugField(populate_from='name', validators=[django.core.validators.RegexValidator(regex=r'^[a-zA-Z_][0-9a-zA-Z_]*$', message=\"Code can only contain the letters a-z, A-Z, digits, and underscores, and can't start with a digit.\")], editable=False, max_length=128, separator='_', blank=True, help_text='Code used for looking up this event programmatically', unique=True, verbose_name='Code'),\n preserve_default=True,\n ),\n ]", "metadata": "root.Migration", "header": "['module', '___EOS___']", "index": 8 } ]
[ { "span": "from django.db import models, migrations", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 40 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", ",_", "migrations_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "osc", "ar_", "._", "models_", "._", "fields_", "._", "autos", "lug", "field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "django_", "._", "core_", "._", "validators_", "\\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_", "(_", "migrations_", "._", "Migration_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dependencies_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "customer", "'_", ",_", "'", "0001", "\\u", "initial", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "operations_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "migrations_", "._", "Alter", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "model", "\\u", "name_", "=_", "'", "communication", "event", "type", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "code", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "field_", "=_", "osc", "ar_", "._", "models_", "._", "fields_", "._", "autos", "lug", "field_", "._", "Auto", "Sl", "ug", "Field_", "(_", "populate", "\\u", "from_", "=_", "'", "name", "'_", ",_", "validators_", "=_", "[_", "django_", "._", "core_", "._", "validators_", "._", "Rege", "x", "Validator_", "(_", "regex_", "=_", "r", "'", "^", "[", "a", "-", "z", "A", "-", "Z", "\\u]", "[", "0", "-", "9", "a", "-", "z", "A", "-", "Z", "\\u]*", "$'_", ",_", "message_", "=_", "\"", "Code", " ", "can", " ", "only", " ", "contain", " ", "the", " ", "letter", "s", " ", "a", "-", "z", ",", " ", "A", "-", "Z", ",", " ", "digit", "s", ",", " ", "and", " ", "underscore", "s", ",", " ", "and", " ", "can", "'", "t", " ", "start", " ", "with", " ", "a", " ", "digit", ".\"_", ")_", "]_", ",_", "editable_", "=_", "False_", ",_", "max", "\\u", "length_", "=_", "128_", ",_", "separator_", "=_", "'\\u'_", ",_", "blank_", "=_", "True_", ",_", "help", "\\u", "text_", "=_", "'", "Code", " ", "used", " ", "for", " ", "look", "ing", " ", "up", " ", "this", " ", "event", " ", "program", "matical", "ly", "'_", ",_", "unique_", "=_", "True_", ",_", "verbo", "se", "\\u", "name_", "=_", "'", "Code", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "preserve", "\\u", "default_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Environment.py
[ { "content": "def apply_tools(env, tools, toolpath):\n # Store the toolpath in the Environment.\n if toolpath is not None:\n env['toolpath'] = toolpath\n\n if not tools:\n return\n # Filter out null tools from the list.\n for tool in [_f for _f in tools if _f]:\n if SCons.Util.is_List(tool) or isinstance(tool, tuple):\n toolname = tool[0]\n toolargs = tool[1] # should be a dict of kw args\n tool = env.Tool(toolname, **toolargs)\n else:\n env.Tool(tool)", "metadata": "root.apply_tools", "header": "['module', '___EOS___']", "index": 92 } ]
[ { "span": "tool ", "start_line": 104, "start_column": 12, "end_line": 104, "end_column": 16 } ]
[ { "span": "tool ", "start_line": 100, "start_column": 8, "end_line": 100, "end_column": 12 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "appl", "y", "\\u", "tools_", "(_", "env_", ",_", "tools_", ",_", "tool", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Stor", "e", " ", "the", " ", "tool", "path", " ", "in", " ", "the", " ", "Environ", "ment", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "tool", "path_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "env_", "[_", "'", "tool", "path", "'_", "]_", "=_", "tool", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "tools_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Filter", " ", "out", " ", "null", " ", "tool", "s", " ", "from", " ", "the", " ", "list", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "tool_", "in_", "[_", "\\u", "f_", "for_", "\\u", "f_", "in_", "tools_", "if_", "\\u", "f_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "SC", "ons_", "._", "Util_", "._", "is", "\\u", "List_", "(_", "tool_", ")_", "or_", "isinstance_", "(_", "tool_", ",_", "tuple_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tool", "name_", "=_", "tool_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tool", "args_", "=_", "tool_", "[_", "1_", "]_", "#", " ", "shou", "ld", " ", "be", " ", "a", " ", "dict", " ", "of", " ", "kw", " ", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tool_", "=_", "env_", "._", "Tool_", "(_", "tool", "name_", ",_", "**_", "tool", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "env_", "._", "Tool_", "(_", "tool_", ")_", "\\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, 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, 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 ]
Unused import
neuropoly/spinalcordtoolbox/dev/sct_segment_gray_matter_asman/sct_asman_old.py
[ { "content": "#!/usr/bin/env python\n########################################################################################################################\n#\n# Asman et al. groupwise multi-atlas segmentation method implementation\n#\n#\n# ----------------------------------------------------------------------------------------------------------------------\n# Copyright (c) 2014 Polytechnique Montreal <www.neuro.polymtl.ca>\n# Authors: Augustin Roux, Sara Dupont\n# Modified: 2015-03-24\n#\n# About the license: see the file LICENSE.TXT\n########################################################################################################################\n\n# TODO change 'target' by 'input'\n# TODO : make it faster\n\n# import os\n# import sys\n# import numpy as np\n# import matplotlib.pyplot as plt\n\nfrom msct_pca import PCA\n# from msct_image import Image\n# from msct_parser import *\nfrom msct_gmseg_utils import *\nimport sct_utils as sct\n\nfrom math import sqrt\nfrom math import exp\n# from math import fabs\n\n\n\n\n########################################################################################################################\n# ----------------------------------------------------- Classes ------------------------------------------------------ #\n########################################################################################################################\n\n# ----------------------------------------------------------------------------------------------------------------------\n# MODEL DICTIONARY -----------------------------------------------------------------------------------------------------\n\n\n# ----------------------------------------------------------------------------------------------------------------------\n# MODEL DICTIONARY SLICE BY SLICE---------------------------------------------------------------------------------------\n\n\n# ----------------------------------------------------------------------------------------------------------------------\n# MODEL ---------------------------------------------------------------------------------------------------------------\n\n\n# ----------------------------------------------------------------------------------------------------------------------\n# TARGET SEGMENTATION PAIRWISE -----------------------------------------------------------------------------------------\n\n\n# ----------------------------------------------------------------------------------------------------------------------\n# TARGET SEGMENTATION GROUPWISE ----------------------------------------------------------------------------------------\n\n\n# ----------------------------------------------------------------------------------------------------------------------\n# GRAY MATTER SEGMENTATION SUPERVISED METHOD ---------------------------------------------------------------------------\n\n\n########################################################################################################################\n# ------------------------------------------------------ MAIN ------------------------------------------------------- #\n########################################################################################################################\n\nif __name__ == \"__main__\":\n param = Param()\n input_target_fname = None\n if param.debug:\n print '\\n*** WARNING: DEBUG MODE ON ***\\n'\n fname_input = param.path_dictionary + \"/errsm_34.nii.gz\"\n fname_input = param.path_dictionary + \"/errsm_34_seg_in.nii.gz\"\n else:\n param_default = Param()\n\n # Initialize the parser\n parser = Parser(__file__)\n parser.usage.set_description('Project all the input image slices on a PCA generated from set of t2star images')\n parser.add_option(name=\"-i\",\n type_value=\"file\",\n description=\"T2star image you want to project\",\n mandatory=True,\n example='t2star.nii.gz')\n parser.add_option(name=\"-dic\",\n type_value=\"folder\",\n description=\"Path to the dictionary of images\",\n mandatory=True,\n example='/home/jdoe/data/dictionary')\n parser.add_option(name=\"-model\",\n type_value=\"multiple_choice\",\n description=\"Load or compute the model\",\n mandatory=True,\n example=['load', 'compute'])\n parser.add_option(name=\"-l\",\n type_value=\"str\",\n description=\"Image containing level labels for the target or str indicating the level\",\n mandatory=False,\n\n example='MNI-Poly-AMU_level_IRP.nii.gz')\n parser.add_option(name=\"-reg\",\n type_value=[[','], 'str'],\n description=\"list of transformations to apply to co-register the dictionary data\",\n mandatory=False,\n default_value=['Affine'],\n example=['SyN'])\n parser.add_option(name=\"-target-reg\",\n type_value='multiple_choice',\n description=\"type of registration of the target to the model space \"\n \"(if pairwise, the registration applied to the target are the same as\"\n \" those of the -reg flag)\",\n mandatory=False,\n default_value='pairwise',\n example=['pairwise', 'groupwise'])\n parser.add_option(name=\"-seg-type\",\n type_value='multiple_choice',\n description=\"type of segmentation (gray matter or white matter)\",\n mandatory=False,\n default_value='wm',\n example=['wm', 'gm', 'gm-model'])\n parser.add_option(name=\"-v\",\n type_value=\"int\",\n description=\"verbose: 0 = nothing, 1 = classic, 2 = expended\",\n mandatory=False,\n default_value=0,\n example='1')\n\n arguments = parser.parse(sys.argv[1:])\n input_target_fname = arguments[\"-i\"]\n param.path_dictionary = arguments[\"-dic\"]\n param.todo_model = arguments[\"-model\"]\n\n if \"-reg\" in arguments:\n param.reg = arguments[\"-reg\"]\n if \"-target-reg\" in arguments:\n param.target_reg = arguments[\"-target-reg\"]\n if \"-seg-type\" in arguments:\n param.seg_type = arguments[\"-seg-type\"]\n if \"-l\" in arguments:\n param.level_fname = arguments[\"-l\"]\n if \"-v\" in arguments:\n param.verbose = arguments[\"-v\"]\n\n gm_seg_method = GMsegSupervisedMethod(input_target_fname, gm_seg_param=param)\n\n if param.verbose == 2:\n gm_seg_method.show()", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Param:", "metadata": "root.Param", "header": "['module', '___EOS___']", "index": 33 }, { "content": " def __init__(self):\n self.debug = 0\n self.path_dictionary = None # '/Volumes/folder_shared/greymattersegmentation/data_asman/dictionary'\n self.todo_model = None # 'compute'\n self.reg = None # TODO : REMOVE THAT PARAM WHEN REGISTRATION IS OPTIMIZED\n self.target_reg = None # TODO : REMOVE THAT PARAM WHEN GROUPWISE/PAIR IS OPTIMIZED\n self.level_fname = None\n self.seg_type = None\n self.verbose = 1", "metadata": "root.Param.__init__", "header": "['class', 'Param', ':', '___EOS___']", "index": 34 }, { "content": "class ModelDictionary:\n \"\"\"\n Dictionary used by the supervised gray matter segmentation method\n \"\"\"\n\n # ------------------------------------------------------------------------------------------------------------------\n\n # ------------------------------------------------------------------------------------------------------------------\n # FUNCTIONS USED TO COMPUTE THE MODEL\n # ------------------------------------------------------------------------------------------------------------------\n\n # ------------------------------------------------------------------------------------------------------------------\n\n # ------------------------------------------------------------------------------------------------------------------\n\n # ------------------------------------------------------------------------------------------------------------------\n\n # ------------------------------------------------------------------------------------------------------------------\n\n '''\n def nb_w_pixels(self):\n s_w_pix = 0\n for slice in self.slices:\n s_w_pix += np.sum(slice.seg)\n return s_w_pix/self.J\n '''\n\n # ------------------------------------------------------------------------------------------------------------------\n\n '''\n # ------------------------------------------------------------------------------------------------------------------\n def compute_majority_vote_mean_seg_old_version(self, seg_data_set):\n \"\"\"\n Compute the mean segmentation image for a given segmentation data set seg_data_set by Majority Vote\n\n :param seg_data_set:\n :return:\n \"\"\"\n mean_seg = []\n # dictionary containing for each possible label value :\n # the sum of all the flatten segmentation in seg_data_set = vector of the sum for each pixel\n choose_maj_vote = {}\n # for 0 and for 1 :\n for l in self.L:\n to_be_summed = []\n for dic_slice in seg_data_set:\n # vector of the pixel corresponding to the label value l in this slice\n # 0 if the pixel is different than the label value, 1 if it's the same\n consistent_vox = []\n for row in dic_slice:\n for i in row:\n try:\n if i > 0.2:\n i = 1\n except ValueError:\n print 'Value Error with i = ', i\n print 'Dataset was : \\n', seg_data_set\n consistent_vox.append(kronecker_delta(i, l))\n to_be_summed.append(consistent_vox)\n summed_vector = np.zeros(len(to_be_summed[0]), dtype=np.int)\n # adding all the vectors of consistent_vox\n for v in to_be_summed:\n summed_vector = np.add(summed_vector, v)\n choose_maj_vote[l] = summed_vector\n\n # for each pixel :\n # the value chosen for mean_seg is the value that was the most present in the data set for this pixel\n for vote_tuple in zip(choose_maj_vote[0], choose_maj_vote[1]):\n if vote_tuple[0] >= vote_tuple[1]:\n mean_seg.append(0)\n elif vote_tuple[1] > vote_tuple[0]:\n mean_seg.append(1)\n n = int(sqrt(self.N))\n return np.asarray(mean_seg).reshape(n, n)\n '''\n\n # ------------------------------------------------------------------------------------------------------------------\n\n # ------------------------------------------------------------------------------------------------------------------\n\n '''\n def crop_data_new_ellipse(self):\n #croping the im_M images\n\n #mean_seg dimensions :\n #height\n down = True\n above = False\n height_min = 0\n height_max = 0\n for h,row in enumerate(self.mean_seg.T):\n if sum(row) == 0:\n if down :\n height_min = h\n elif not above:\n height_max = h\n above = True\n else:\n down = False\n height_min += 1\n height_max -= 1\n\n #width\n left = True\n right = False\n width_min = 0\n width_max = 0\n for w,row in enumerate(self.mean_seg):\n if sum(row) == 0:\n if left :\n width_min = w\n elif not right:\n width_max = w\n right = True\n else:\n left = False\n width_min += 1\n width_max -= 1\n\n a = (width_max - width_min)/2.0\n b = (height_max - height_min)/2.0\n\n range_x = np.asarray(range(int(-10*a),int(10*a)+1)) /10.0\n top_points = [(b * sqrt(1-(x**2/a**2)),x) for x in range_x]\n n = int(sqrt(self.N))\n\n top_points.sort()\n\n ellipse_mask = np.zeros((n,n))\n done_rows = []\n for point in top_points:\n y_plus = int(round((n/2)+point[0]))\n y_minus = int(round((n/2)-point[0]))\n print 'y_plus', y_plus, 'y_minus', y_minus\n if y_plus not in done_rows:\n x_plus = int(round((n/2)+abs(point[1])))\n x_minus = int(round((n/2)-abs(point[1])))\n for x in range(x_minus, x_plus+1):\n ellipse_mask[x, y_plus] = 1\n ellipse_mask[x, y_minus] = 1\n done_rows.append(y_plus)\n\n\n print 'axis', a, b\n print 'done_rows', done_rows\n print 'center : ', int(n/2)\n print ellipse_mask\n save_image(ellipse_mask, 'ellipse_mask', path=self.model_dic_name+'/', type='uint8')\n '''\n\n '''\n # ------------------------------------------------------------------------------------------------------------------\n def crop_data(self):\n \"\"\"\n Crop the model images (im_M) to an ellipse shape to get rid of the size/shape variability between slices\n \"\"\"\n im_mean_seg = Image(param=self.mean_seg)\n\n nz_coord = im_mean_seg.getNonZeroCoordinates()\n nz_coord_dic = {}\n for coord in nz_coord:\n nz_coord_dic[coord.x] = []\n for coord in nz_coord:\n nz_coord_dic[coord.x].append(coord.y)\n\n ellipse_mask = im_mean_seg.copy().data\n\n for x, y_list in nz_coord_dic.items():\n full_y_list = range(min(y_list), max(y_list)+1)\n if y_list != full_y_list:\n for y in full_y_list:\n ellipse_mask[x, y] = 1\n\n save_image(ellipse_mask, 'ellipse_mask', path=self.model_dic_name+'/', im_type='uint8')\n\n for dic_slice in self.slices:\n new_im_m = np.einsum('ij,ij->ij', ellipse_mask, dic_slice.im_M)\n dic_slice.set(im_m=new_im_m)\n '''\n # ------------------------------------------------------------------------------------------------------------------\n # END OF FUNCTIONS USED TO COMPUTE THE MODEL\n # ------------------------------------------------------------------------------------------------------------------\n # TODO: ADAPT LOAD DIC TO GM_SEG AND WM_SEG ATTRIBUTES FOR THE SLICES\n # ------------------------------------------------------------------------------------------------------------------\n\n # ------------------------------------------------------------------------------------------------------------------", "metadata": "root.ModelDictionary", "header": "['module', '___EOS___']", "index": 51 }, { "content": " def __init__(self, dic_param=None):\n \"\"\"\n model dictionary constructor\n\n :param dic_param: dictionary parameters, type: Param\n \"\"\"\n if dic_param is None:\n self.param = Param()\n else:\n self.param = dic_param\n\n # list of the slices of the dictionary\n self.slices = [] # type: list of slices\n # number of slices\n self.J = 0 # type: int\n # dimension of the slices (flattened)\n self.N = 0 # type: int\n # mean segmentation image of the dictionary\n self.mean_seg = None # type: numpy array\n # mean image of the dictionary\n self.mean_image = None # type: numpy array\n\n # dictionary containing information about the data dictionary slices by subject : used to save the model only\n # self.dic_data_info[subject] = {'n_slices': 0, 'inverted_gm_seg': [], 'im_M': [], 'seg_M': []}\n self.dic_data_info = {} # type: dictionary\n\n # list of transformation to apply to each slice to co-register the data into the common groupwise space\n if self.param.reg is not None:\n self.coregistration_transfos = self.param.reg\n else:\n self.coregistration_transfos = ['Affine']\n\n suffix = ''\n for transfo in self.coregistration_transfos:\n suffix += '_' + transfo\n # self.coregistration_transfos = ['SyN']\n\n # folder containing the saved model\n self.model_dic_name = ''\n if self.param.todo_model == 'compute':\n self.model_dic_name = './gmseg_model_dictionary' + suffix # TODO: remove suffix\n self.compute_model_dictionary()\n elif self.param.todo_model == 'load':\n self.model_dic_name = self.param.path_dictionary # TODO change the path by the name of the dic ?? ...\n self.load_model_dictionary()\n else:\n sct.printv('WARNING: no todo_model param', self.param.verbose, 'warning')\n\n # save all the dictionary slices\n # TODO: --> not used by the model, only for visualization\n\n '''\n if 'data_by_slice' not in os.listdir('.'):\n sct.run('mkdir ./data_by_slice')\n os.chdir('./data_by_slice')\n for j in range(self.J):\n save_image(self.slices[j].im, 'slice_'+str(j) + '_im')\n save_image(self.slices[j].im_M, 'slice_'+str(j) + '_registered_im')\n\n save_image(self.slices[j].seg, 'slice_'+str(j) + '_seg')\n save_image(self.slices[j].seg_M, 'slice_'+str(j) + '_registered_seg')\n os.chdir('..')\n '''\n\n '''\n if self.param.verbose == 2:\n self.show_data()\n '''", "metadata": "root.ModelDictionary.__init__", "header": "['class', 'ModelDictionary', ':', '___EOS___']", "index": 55 }, { "content": " def compute_model_dictionary(self):\n \"\"\"\n Compute the model dictionary using the provided data set\n \"\"\"\n sct.printv('\\nComputing the model dictionary ...', self.param.verbose, 'normal')\n # Load all the images' slices from param.path_dictionary\n sct.printv('\\nLoading data dictionary ...', self.param.verbose, 'normal')\n # List of T2star images (im) and their label decision (seg) (=segmentation of the gray matter), slice by slice\n\n sct.run('mkdir ' + self.model_dic_name)\n\n self.slices = self.load_data_dictionary()\n\n # number of slices in the data set\n self.J = len([dic_slice.im for dic_slice in self.slices])\n # dimension of the data (flatten slices)\n self.N = len(self.slices[0].im.flatten())\n\n self.save_model_data('im')\n\n if self.param.seg_type != 'gm-model':\n # inverts the segmentation slices : the model uses segmentation of the WM instead of segmentation of the GM\n self.invert_seg()\n self.save_model_data('inverted_gm_seg')\n\n sct.printv('\\nComputing the transformation to co-register all the data into a common groupwise space ...',\n self.param.verbose, 'normal')\n\n self.mean_seg = self.seg_coregistration(transfo_to_apply=self.coregistration_transfos)\n self.save_model_data('seg_M')\n\n sct.printv('\\nCo-registering all the data into the common groupwise space ...', self.param.verbose, 'normal')\n\n # List of images (im_M) and their label decision (seg_M) (=segmentation of the gray matter),\n # --> slice by slice in the common groupwise space\n self.coregister_data(transfo_to_apply=self.coregistration_transfos)\n\n '''\n TESTING\n\n self.crop_data()\n '''\n\n self.save_model_data('im_M')\n\n self.mean_image = self.compute_mean_dic_image(np.asarray([dic_slice.im_M for dic_slice in self.slices]))\n save_image(self.mean_image, 'mean_image', path=self.model_dic_name+'/', im_type='uint8')", "metadata": "root.ModelDictionary.compute_model_dictionary", "header": "['class', 'ModelDictionary', ':', '___EOS___']", "index": 125 }, { "content": " def load_data_dictionary(self):\n \"\"\"\n each slice of each subject will be loaded separately in a Slice object containing :\n\n - a slice id\n\n - the original T2star image crop around the spinal cord: im\n\n - a manual segmentation of the gray matter: seg\n\n :return slices: numpy array of all the slices of the data dictionary\n \"\"\"\n # initialization\n slices = []\n j = 0\n # TODO: change the name of files to find to a more general structure\n for subject_dir in os.listdir(self.param.path_dictionary):\n subject_path = self.param.path_dictionary + '/' + subject_dir\n if os.path.isdir(subject_path):\n self.dic_data_info[subject_dir] = {'n_slices': 0, 'inverted_gm_seg': [], 'im_M': [], 'seg_M': []}\n\n subject_seg_in = ''\n subject_gm_seg = ''\n sct.run('mkdir ' + self.model_dic_name + '/' + subject_dir, verbose=self.param.verbose)\n for file_name in os.listdir(subject_path):\n if 'GM' in file_name or 'gmseg' in file_name:\n subject_gm_seg = file_name\n '''\n # copy of the seg image in the saved model folder\n sct.run('cp ./' + self.param.path_dictionary + subject_dir + '/' + file_name\n + ' ' + self.model_dic_name + '/' + subject_dir + '/' + subject_dir + '_seg.nii.gz')\n '''\n if 'seg_in' in file_name and 'gm' not in file_name.lower():\n subject_seg_in = file_name\n '''\n # copy of the slice image in the saved model folder\n sct.run('cp ./' + self.param.path_dictionary + subject_dir + '/' + file_name\n + ' ' + self.model_dic_name + '/' + subject_dir + '/' + subject_dir + '_im.nii.gz')\n '''\n\n im = Image(subject_path + '/' + subject_seg_in)\n seg = Image(subject_path + '/' + subject_gm_seg)\n\n for im_slice, seg_slice in zip(im.data, seg.data):\n self.dic_data_info[subject_dir]['n_slices'] += 1\n slices.append(Slice(slice_id=j, im=im_slice, gm_seg=seg_slice, reg_to_m=[]))\n j += 1\n\n return np.asarray(slices)", "metadata": "root.ModelDictionary.load_data_dictionary", "header": "['class', 'ModelDictionary', ':', '___EOS___']", "index": 178 }, { "content": " def save_model_data(self, what_to_save):\n \"\"\"\n save 3D images of the model dictionary using the dictionary of information about the data slices by subject\n\n :param what_to_save: type of data to be saved\n \"\"\"\n suffix = ''\n data_to_save = []\n total_n_slices = 0\n if what_to_save == 'gm_seg':\n suffix = '_gm_seg'\n data_to_save = [dic_slice.gm_seg for dic_slice in self.slices]\n if what_to_save == 'inverted_gm_seg':\n suffix = '_wm_seg'\n data_to_save = [dic_slice.wm_seg for dic_slice in self.slices]\n elif what_to_save == 'im':\n suffix = '_im'\n data_to_save = [dic_slice.im for dic_slice in self.slices]\n elif what_to_save == 'im_M':\n suffix = '_im_model_space'\n data_to_save = [dic_slice.im_M for dic_slice in self.slices]\n elif what_to_save == 'gm_seg_M':\n suffix = '_gm_seg_model_space'\n data_to_save = [dic_slice.gm_seg_M for dic_slice in self.slices]\n elif what_to_save == 'wm_seg_M':\n suffix = '_wm_seg_model_space'\n data_to_save = [dic_slice.wm_seg_M for dic_slice in self.slices]\n\n for subject_name in sorted(self.dic_data_info.keys()):\n first_subject_slice = total_n_slices\n last_subject_slice = first_subject_slice + self.dic_data_info[subject_name]['n_slices']\n self.dic_data_info[subject_name][what_to_save] = data_to_save[first_subject_slice:last_subject_slice]\n total_n_slices += self.dic_data_info[subject_name]['n_slices']\n\n for subject_name, info in zip(self.dic_data_info.keys(), self.dic_data_info.values()):\n for i, slice_i in enumerate(info[what_to_save]):\n\n to_save = Image(param=np.asarray(slice_i))\n to_save.path = self.model_dic_name + '/' + subject_name + '/'\n\n to_save.file_name = subject_name + '_slice' + str(i) + suffix\n to_save.ext = '.nii.gz'\n to_save.save(type='minimize')", "metadata": "root.ModelDictionary.save_model_data", "header": "['class', 'ModelDictionary', ':', '___EOS___']", "index": 229 }, { "content": " def invert_seg(self):\n \"\"\"\n Invert the gray matter segmentation to get segmentation of the white matter instead\n keeps more information, theoretically better results\n \"\"\"\n for dic_slice in self.slices:\n im_dic = Image(param=dic_slice.im)\n sc = im_dic.copy()\n nz_coord_sc = sc.getNonZeroCoordinates()\n im_seg = Image(param=dic_slice.gm_seg)\n nz_coord_d = im_seg.getNonZeroCoordinates()\n for coord in nz_coord_sc:\n sc.data[coord.x, coord.y] = 1\n for coord in nz_coord_d:\n im_seg.data[coord.x, coord.y] = 1\n # cast of the -1 values (-> GM pixel at the exterior of the SC pixels) to +1 --> WM pixel\n inverted_slice_seg = np.absolute(sc.data - im_seg.data).astype(int)\n dic_slice.set(wm_seg=inverted_slice_seg)", "metadata": "root.ModelDictionary.invert_seg", "header": "['class', 'ModelDictionary', ':', '___EOS___']", "index": 274 }, { "content": " def seg_coregistration(self, transfo_to_apply=None):\n \"\"\"\n For all the segmentation slices, do a registration of the segmentation slice to the mean segmentation\n applying all the transformations in transfo_to_apply\n\n Compute, apply and save each transformation warping field for all the segmentation slices\n\n Compute the new mean segmentation at each step and update self.mean_seg\n\n :param transfo_to_apply: list of string\n :return:\n \"\"\"\n if self.param.seg_type == 'gm-model':\n current_mean_seg = compute_majority_vote_mean_seg(np.asarray([dic_slice.gm_seg for dic_slice in self.slices]))\n else:\n current_mean_seg = compute_majority_vote_mean_seg(np.asarray([dic_slice.wm_seg for dic_slice in self.slices]))\n\n for transfo in transfo_to_apply:\n sct.printv('Doing a ' + transfo + ' registration of each segmentation slice to the mean segmentation ...', self.param.verbose, 'normal')\n current_mean_seg = self.find_coregistration(mean_seg=current_mean_seg, transfo_type=transfo)\n\n '''\n fig=plt.figure()\n plt.imshow(current_mean_seg)\n plt.title('Current mean segmentation ...')\n plt.plot()\n\n fig=plt.figure()\n plt.imshow(self.slices[0].seg_M)\n plt.title('slice 0...')\n plt.plot()\n\n # mean number of white pixels in the manual segmentation slices of the dictionary\n mean_white_pix = self.nb_w_pixels()\n print mean_white_pix\n\n\n i=1\n while np.sum(current_mean_seg) < 0.8*mean_white_pix:\n print '--> Affine registration number ',i\n print 'number of white pixels in the current mean seg', np.sum(current_mean_seg)\n current_mean_seg = self.compute_mean_seg(np.asarray([slice.seg_M for slice in self.slices]))\n current_mean_seg = self.find_coregistration(mean_seg=current_mean_seg, transfo_type='Affine')\n i+=10\n #current_mean_seg = self.compute_mean_seg(np.asarray([slice.seg_M for slice in self.slices]))\n current_mean_seg = self.find_coregistration(mean_seg=current_mean_seg, transfo_type='Affine')\n '''\n resulting_mean_seg = current_mean_seg\n\n return resulting_mean_seg", "metadata": "root.ModelDictionary.seg_coregistration", "header": "['class', 'ModelDictionary', ':', '___EOS___']", "index": 294 }, { "content": " def find_coregistration(self, mean_seg=None, transfo_type='Rigid', first=True):\n \"\"\"\n For each segmentation slice, apply and save a registration of the specified type of transformation\n the name of the registration file (usually a matlab matrix) is saved in self.RtoM\n\n :param mean_seg: current mean segmentation\n\n :param transfo_type: type of transformation for the registration\n\n :return mean seg: updated mean segmentation\n \"\"\"\n for dic_slice in self.slices:\n name_j_transform = 'transform_slice_' + str(dic_slice.id) + find_ants_transfo_name(transfo_type)[0]\n new_reg_list = dic_slice.reg_to_M.append(name_j_transform)\n dic_slice.set(reg_to_m=new_reg_list)\n if first:\n if self.param.seg_type == 'gm-model':\n seg_m = apply_ants_transfo(mean_seg, dic_slice.gm_seg, transfo_name=name_j_transform, path=self.model_dic_name + '/', transfo_type=transfo_type)\n else:\n seg_m = apply_ants_transfo(mean_seg, dic_slice.wm_seg, transfo_name=name_j_transform, path=self.model_dic_name + '/', transfo_type=transfo_type)\n else:\n if self.param.seg_type == 'gm-model':\n seg_m = apply_ants_transfo(mean_seg, dic_slice.gm_seg_M, transfo_name=name_j_transform, path=self.model_dic_name + '/', transfo_type=transfo_type)\n else:\n seg_m = apply_ants_transfo(mean_seg, dic_slice.wm_seg_M, transfo_name=name_j_transform, path=self.model_dic_name + '/', transfo_type=transfo_type)\n if self.param.seg_type == 'gm-model':\n dic_slice.set(gm_seg_m=seg_m.astype(int))\n dic_slice.set(gm_seg_m_flat=seg_m.flatten().astype(int))\n else:\n dic_slice.set(wm_seg_m=seg_m.astype(int))\n dic_slice.set(wm_seg_m_flat=seg_m.flatten().astype(int))\n\n if self.param.seg_type == 'gm-model':\n mean_seg = compute_majority_vote_mean_seg([dic_slice.gm_seg_M for dic_slice in self.slices])\n else:\n mean_seg = compute_majority_vote_mean_seg([dic_slice.wm_seg_M for dic_slice in self.slices])\n\n save_image(mean_seg, 'mean_seg', path=self.model_dic_name+'/', im_type='uint8')\n\n return mean_seg", "metadata": "root.ModelDictionary.find_coregistration", "header": "['class', 'ModelDictionary', ':', '___EOS___']", "index": 354 }, { "content": " def compute_mean_dic_image(self, im_data_set):\n \"\"\"\n Compute the mean image of the dictionary\n\n Used to co-register the dictionary images into teh common groupwise space\n\n :param im_data_set:\n :return mean: mean image of the input data set\n \"\"\"\n mean = np.sum(im_data_set, axis=0)\n\n mean /= float(self.J)\n\n return mean", "metadata": "root.ModelDictionary.compute_mean_dic_image", "header": "['class', 'ModelDictionary', ':', '___EOS___']", "index": 443 }, { "content": " def coregister_data(self, transfo_to_apply=None):\n \"\"\"\n Apply to each image slice of the dictionary the transformations found registering the segmentation slices.\n The co_registered images are saved for each slice as im_M\n\n :param transfo_to_apply: list of string\n :return:\n \"\"\"\n list_im = [dic_slice.im for dic_slice in self.slices]\n list_gm_seg = [dic_slice.gm_seg for dic_slice in self.slices]\n \n for dic_slice in self.slices:\n for n_transfo, transfo in enumerate(transfo_to_apply):\n im_m = apply_ants_transfo(self.compute_mean_dic_image(list_im), dic_slice.im, search_reg=False, transfo_name=dic_slice.reg_to_M[n_transfo], binary=False, path=self.model_dic_name+'/', transfo_type=transfo)\n # apply_2D_rigid_transformation(self.im[j], self.RM[j]['tx'], self.RM[j]['ty'], self.RM[j]['theta'])\n if self.param.seg_type == 'gm':\n gm_seg_m = apply_ants_transfo(self.compute_mean_dic_image(list_gm_seg), dic_slice.gm_seg, search_reg=False, transfo_name=dic_slice.reg_to_M[n_transfo], binary=False, path=self.model_dic_name+'/', transfo_type=transfo)\n\n dic_slice.set(im_m=im_m)\n dic_slice.set(im_m_flat=im_m.flatten())\n if self.param.seg_type == 'gm':\n dic_slice.set(gm_seg_m=gm_seg_m)\n dic_slice.set(gm_seg_m_flat=gm_seg_m.flatten())", "metadata": "root.ModelDictionary.coregister_data", "header": "['class', 'ModelDictionary', ':', '___EOS___']", "index": 459 }, { "content": " def load_model_dictionary(self):\n \"\"\"\n Load the model dictionary from a saved one\n \"\"\"\n import itertools\n\n sct.printv('\\nLoading the model dictionary ...', self.param.verbose, 'normal')\n\n j = 0\n for subject_dir in os.listdir(self.model_dic_name):\n subject_path = self.model_dic_name + subject_dir\n if os.path.isdir(subject_path) and 'transformations' not in subject_path:\n subject_im = None\n im_mat = None\n subject_seg = None\n seg_mat = None\n subject_im_m = None\n im_m = None\n subject_seg_m = None\n seg_m = None\n\n for file_name in os.listdir(subject_path):\n if '_im.nii' in file_name:\n subject_im = file_name\n if '_seg.nii' in file_name:\n subject_seg = file_name\n if '_im_model_space.nii' in file_name:\n subject_im_m = file_name\n if '_seg_model_space.nii' in file_name:\n subject_seg_m = file_name\n if subject_im is not None:\n im = Image(subject_path + '/' + subject_im)\n im_mat = im.data\n if subject_seg is not None:\n seg = Image(subject_path + '/' + subject_seg)\n seg_mat = seg.data\n if subject_im_m is not None:\n im_m = Image(subject_path + '/' + subject_im_m)\n else:\n sct.printv('WARNING: no dictionary image in model space for ' + subject_dir,\n self.param.verbose, 'warning')\n if subject_seg_m is not None:\n seg_m = Image(subject_path + '/' + subject_seg_m)\n else:\n sct.printv('WARNING: no segmentation in model space for ' + subject_dir,\n self.param.verbose, 'warning')\n if im_mat is None:\n im_mat = itertools.repeat(None, im_m.data.shape[0])\n if seg_mat is None:\n seg_mat = itertools.repeat(None, im_m.data.shape[0])\n\n for im_slice, seg_slice, im_m_slice, seg_m_slice in zip(im_mat, seg_mat, im_m.data, seg_m.data):\n reg_list = ['transform_slice_' + str(j) + find_ants_transfo_name(transfo_type)[0]\n for transfo_type in self.coregistration_transfos]\n self.slices.append(Slice(slice_id=j, im=im_slice, seg=seg_slice, im_m=im_m_slice, seg_m=seg_m_slice,\n im_m_flat=im_m_slice.flatten(), seg_m_flat=seg_m_slice.flatten(),\n reg_to_m=reg_list))\n j += 1\n\n # number of atlases in the dictionary\n self.J = len(self.slices) # len([slice.im for slice in self.slices])\n\n # dimension of the data (flatten slices)\n self.N = len(self.slices[0].im_M.flatten())\n\n self.mean_image = Image(self.model_dic_name + 'mean_image.nii.gz').data\n self.mean_seg = Image(self.model_dic_name + 'mean_seg.nii.gz').data", "metadata": "root.ModelDictionary.load_model_dictionary", "header": "['class', 'ModelDictionary', ':', '___EOS___']", "index": 587 }, { "content": " def show_data(self):\n \"\"\"\n show the 10 first slices of the model dictionary\n \"\"\"\n for dic_slice in self.slices[:10]:\n fig = plt.figure()\n\n seg_subplot = fig.add_subplot(2, 3, 1)\n seg_subplot.set_title('Original space - seg')\n im_seg = seg_subplot.imshow(dic_slice.wm_seg)\n im_seg.set_interpolation('nearest')\n im_seg.set_cmap('gray')\n\n seg_m_subplot = fig.add_subplot(2, 3, 2)\n seg_m_subplot.set_title('Common groupwise space - seg')\n im_seg_m = seg_m_subplot.imshow(dic_slice.wm_seg_M)\n im_seg_m.set_interpolation('nearest')\n im_seg_m.set_cmap('gray')\n\n mean_seg_subplot = fig.add_subplot(2, 3, 3)\n mean_seg_subplot.set_title('Mean seg')\n im_mean_seg = mean_seg_subplot.imshow(np.asarray(self.mean_seg))\n im_mean_seg.set_interpolation('nearest')\n im_mean_seg.set_cmap('gray')\n\n slice_im_subplot = fig.add_subplot(2, 3, 4)\n slice_im_subplot.set_title('Original space - data ')\n im_slice_im = slice_im_subplot.imshow(dic_slice.im)\n im_slice_im.set_interpolation('nearest')\n im_slice_im.set_cmap('gray')\n\n slice_im_m_subplot = fig.add_subplot(2, 3, 5)\n slice_im_m_subplot.set_title('Common groupwise space - data ')\n im_slice_im_m = slice_im_m_subplot.imshow(dic_slice.im_M)\n im_slice_im_m.set_interpolation('nearest')\n im_slice_im_m.set_cmap('gray')\n\n plt.suptitle('Slice ' + str(dic_slice.id))\n plt.show()", "metadata": "root.ModelDictionary.show_data", "header": "['class', 'ModelDictionary', ':', '___EOS___']", "index": 656 }, { "content": "class ModelDictionaryBySlice:\n \"\"\"\n Dictionary used by the supervised gray matter segmentation method\n \"\"\"\n\n # ------------------------------------------------------------------------------------------------------------------\n\n # ------------------------------------------------------------------------------------------------------------------\n # FUNCTIONS USED TO COMPUTE THE MODEL\n # ------------------------------------------------------------------------------------------------------------------\n\n # ------------------------------------------------------------------------------------------------------------------\n\n # ------------------------------------------------------------------------------------------------------------------\n\n # ------------------------------------------------------------------------------------------------------------------\n\n # ------------------------------------------------------------------------------------------------------------------\n\n # ------------------------------------------------------------------------------------------------------------------\n\n # ------------------------------------------------------------------------------------------------------------------\n\n # ------------------------------------------------------------------------------------------------------------------\n\n # ------------------------------------------------------------------------------------------------------------------\n # END OF FUNCTIONS USED TO COMPUTE THE MODEL\n # ------------------------------------------------------------------------------------------------------------------\n # TODO: ADAPT LOAD MODEL TO GMSEG AND WMSEG ATTRIBUTES OF SLCIES\n # ------------------------------------------------------------------------------------------------------------------\n\n # ------------------------------------------------------------------------------------------------------------------", "metadata": "root.ModelDictionaryBySlice", "header": "['module', '___EOS___']", "index": 699 }, { "content": " def __init__(self, dic_param=None):\n \"\"\"\n model dictionary constructor\n\n :param dic_param: dictionary parameters, type: Param\n \"\"\"\n if dic_param is None:\n self.param = Param()\n else:\n self.param = dic_param\n\n self.level_label = {0: '', 1: 'C1', 2: 'C2', 3: 'C3', 4: 'C4', 5: 'C5', 6: 'C6', 7: 'C7', 8: 'T1', 9: 'T2',\n 10: 'T3', 11: 'T4', 12: 'T5', 13: 'T6'}\n\n # list of the slices of the dictionary\n self.slices = [] # type: list of slices\n # number of slices\n self.J = 0 # type: int\n # dimension of the slices (flattened)\n self.N = 0 # type: int\n # mean segmentation image of the dictionary\n self.mean_seg = None # type: numpy array\n # mean image of the dictionary\n self.mean_image = None # type: numpy array\n\n # dictionary containing information about the data dictionary slices by subject : used to save the model only\n # self.dic_data_info[subject] = {'n_slices': 0, 'inverted_gm_seg': [], 'im_M': [], 'seg_M': []}\n self.dic_data_info = {} # type: dictionary\n\n # list of transformation to apply to each slice to co-register the data into the common groupwise space\n if self.param.reg is not None:\n self.coregistration_transfos = self.param.reg\n else:\n self.coregistration_transfos = ['Affine']\n\n suffix = ''\n for transfo in self.coregistration_transfos:\n suffix += '_' + transfo\n suffix += '_' + self.param.seg_type[0:2]\n # self.coregistration_transfos = ['SyN']\n\n # folder containing the saved model\n self.model_dic_name = ''\n if self.param.todo_model == 'compute':\n self.model_dic_name = './gmseg_model_dictionary' + suffix # TODO: remove suffix when reg is optimized\n self.compute_model_dictionary()\n elif self.param.todo_model == 'load':\n self.model_dic_name = self.param.path_dictionary # TODO change the path by the name of the dic ?? ...\n self.load_model_dictionary()\n else:\n sct.printv('WARNING: no todo_model param', self.param.verbose, 'warning')", "metadata": "root.ModelDictionaryBySlice.__init__", "header": "['class', 'ModelDictionaryBySlice', ':', '___EOS___']", "index": 703 }, { "content": " def compute_model_dictionary(self):\n \"\"\"\n Compute the model dictionary using the provided data set\n \"\"\"\n sct.printv('\\nComputing the model dictionary ...', self.param.verbose, 'normal')\n # Load all the images' slices from param.path_dictionary\n sct.printv('\\nLoading data dictionary ...', self.param.verbose, 'normal')\n # List of T2star images (im) and their label decision (seg) (=segmentation of the gray matter), slice by slice\n\n sct.run('mkdir ' + self.model_dic_name)\n\n self.slices = self.load_data_dictionary()\n\n # number of slices in the data set\n self.J = len([dic_slice.im for dic_slice in self.slices])\n # dimension of the data (flatten slices)\n self.N = len(self.slices[0].im.flatten())\n\n if self.param.seg_type != 'gm-model':\n # inverts the segmentation slices : the model uses segmentation of the WM instead of segmentation of the GM\n self.invert_seg()\n self.save_model_data('inverted_gm_seg')\n\n sct.printv('\\nComputing the transformation to co-register all the data into a common groupwise space ...',\n self.param.verbose, 'normal')\n\n self.mean_seg = self.seg_coregistration(transfo_to_apply=self.coregistration_transfos)\n if self.param.seg_type == 'gm-model':\n self.save_model_data('gm_seg_M')\n else:\n self.save_model_data('wm_seg_M')\n\n\n sct.printv('\\nCo-registering all the data into the common groupwise space ...', self.param.verbose, 'normal')\n\n # List of images (im_M) and their label decision (seg_M) (=segmentation of the gray matter),\n # --> slice by slice in the common groupwise space\n self.coregister_data(transfo_to_apply=self.coregistration_transfos)\n\n self.save_model_data('im_M')\n\n self.mean_image = self.compute_mean_dic_image(np.asarray([dic_slice.im_M for dic_slice in self.slices]))\n save_image(self.mean_image, 'mean_image', path=self.model_dic_name+'/', im_type='uint8')", "metadata": "root.ModelDictionaryBySlice.compute_model_dictionary", "header": "['class', 'ModelDictionaryBySlice', ':', '___EOS___']", "index": 756 }, { "content": " def load_data_dictionary(self):\n \"\"\"\n each slice of each subject will be loaded separately in a Slice object containing :\n\n - a slice id\n\n - the original T2star image crop around the spinal cord: im\n\n - a manual segmentation of the gray matter: seg\n\n :return slices: numpy array of all the slices of the data dictionary\n \"\"\"\n # initialization\n slices = []\n total_j_im = 0\n total_j_seg = 0\n # TODO: change the name of files to find to a more general structure\n for subject_dir in os.listdir(self.param.path_dictionary):\n subject_path = self.param.path_dictionary + '/' + subject_dir\n if os.path.isdir(subject_path):\n self.dic_data_info[subject_dir] = {'n_slices': 0, 'inverted_gm_seg': [], 'im_M': [], 'seg_M': [], 'levels': []}\n j_im = 0\n j_seg = 0\n first_slice = total_j_im\n sct.run('mkdir ' + self.model_dic_name + '/' + subject_dir, verbose=self.param.verbose)\n for file_name in os.listdir(subject_path):\n if 'im' in file_name:\n slice_level = 0\n name_list = file_name.split('_')\n for word in name_list:\n if word in self.level_label.values():\n slice_level = get_key_from_val(self.level_label, word)\n\n slices.append(Slice(slice_id=total_j_im, im=Image(subject_path + '/' + file_name).data, level=slice_level, reg_to_m=[]))\n self.dic_data_info[subject_dir]['levels'].append(slice_level)\n\n # copy of the slice image in the saved model folder\n if j_im < 10:\n j_im_str = str(j_im)\n j_im_str = '0' + j_im_str\n else:\n j_im_str = str(j_im)\n\n im_file_name = subject_dir + '_slice' + j_im_str + '_' + self.level_label[slice_level] + '_im.nii.gz'\n sct.run('cp ./' + self.param.path_dictionary + '/' + subject_dir + '/' + file_name + ' ' + self.model_dic_name + '/' + subject_dir + '/' + im_file_name)\n j_im += 1\n total_j_im += 1\n\n if 'seg' in file_name:\n slices[total_j_seg].set(gm_seg=Image(subject_path + '/' + file_name).data)\n j_seg += 1\n total_j_seg += 1\n\n if j_im == j_seg:\n self.dic_data_info[subject_dir]['n_slices'] = (first_slice, total_j_im)\n else:\n sct.printv('ERROR: subject ' + subject_dir + ' doesn\\'t have the same number of slice images and segmentations', verbose=self.param.verbose, type='error')\n\n return np.asarray(slices)", "metadata": "root.ModelDictionaryBySlice.load_data_dictionary", "header": "['class', 'ModelDictionaryBySlice', ':', '___EOS___']", "index": 805 }, { "content": " def save_model_data(self, what_to_save):\n \"\"\"\n save 3D images of the model dictionary using the dictionary of information about the data slices by subject\n\n :param what_to_save: type of data to be saved\n \"\"\"\n suffix = ''\n data_to_save = []\n if what_to_save == 'gm_seg':\n suffix = '_gm_seg'\n data_to_save = [dic_slice.gm_seg for dic_slice in self.slices]\n if what_to_save == 'inverted_gm_seg':\n suffix = '_wm_seg'\n data_to_save = [dic_slice.wm_seg for dic_slice in self.slices]\n elif what_to_save == 'im':\n suffix = '_im'\n data_to_save = [dic_slice.im for dic_slice in self.slices]\n elif what_to_save == 'im_M':\n suffix = '_im_model_space'\n data_to_save = [dic_slice.im_M for dic_slice in self.slices]\n elif what_to_save == 'gm_seg_M':\n suffix = '_gm_seg_model_space'\n data_to_save = [dic_slice.gm_seg_M for dic_slice in self.slices]\n elif what_to_save == 'wm_seg_M':\n suffix = '_wm_seg_model_space'\n data_to_save = [dic_slice.wm_seg_M for dic_slice in self.slices]\n\n for subject_name in sorted(self.dic_data_info.keys()):\n first_subject_slice, last_subject_slice = self.dic_data_info[subject_name]['n_slices']\n self.dic_data_info[subject_name][what_to_save] = data_to_save[first_subject_slice:last_subject_slice]\n\n for i, slice_i in enumerate(self.dic_data_info[subject_name][what_to_save]):\n to_save = Image(param=np.asarray(slice_i))\n to_save.path = self.model_dic_name + '/' + subject_name + '/'\n\n if i < 10:\n i_str = str(i)\n i_str = '0' + i_str\n else:\n i_str = str(i)\n to_save.file_name = subject_name + '_slice' + i_str + '_' + self.level_label[self.dic_data_info[subject_name]['levels'][i]] + suffix\n to_save.ext = '.nii.gz'\n to_save.save(type='minimize')", "metadata": "root.ModelDictionaryBySlice.save_model_data", "header": "['class', 'ModelDictionaryBySlice', ':', '___EOS___']", "index": 866 }, { "content": " def invert_seg(self):\n \"\"\"\n Invert the gray matter segmentation to get segmentation of the white matter instead\n keeps more information, theoretically better results\n \"\"\"\n for dic_slice in self.slices:\n im_dic = Image(param=dic_slice.im)\n sc = im_dic.copy()\n nz_coord_sc = sc.getNonZeroCoordinates()\n im_seg = Image(param=dic_slice.gm_seg)\n nz_coord_d = im_seg.getNonZeroCoordinates()\n for coord in nz_coord_sc:\n sc.data[coord.x, coord.y] = 1\n for coord in nz_coord_d:\n im_seg.data[coord.x, coord.y] = 1\n # cast of the -1 values (-> GM pixel at the exterior of the SC pixels) to +1 --> WM pixel\n inverted_slice_decision = np.absolute(sc.data - im_seg.data).astype(int)\n dic_slice.set(wm_seg=inverted_slice_decision)", "metadata": "root.ModelDictionaryBySlice.invert_seg", "header": "['class', 'ModelDictionaryBySlice', ':', '___EOS___']", "index": 911 }, { "content": " def seg_coregistration(self, transfo_to_apply=None):\n \"\"\"\n For all the segmentation slices, do a registration of the segmentation slice to the mean segmentation\n applying all the transformations in transfo_to_apply\n\n Compute, apply and save each transformation warping field for all the segmentation slices\n\n Compute the new mean segmentation at each step and update self.mean_seg\n\n :param transfo_to_apply: list of string\n :return:\n \"\"\"\n if self.param.seg_type == 'gm-model':\n current_mean_seg = compute_majority_vote_mean_seg(np.asarray([dic_slice.gm_seg for dic_slice in self.slices]))\n else:\n current_mean_seg = compute_majority_vote_mean_seg(np.asarray([dic_slice.wm_seg for dic_slice in self.slices]))\n\n for transfo in transfo_to_apply:\n sct.printv('Doing a ' + transfo + ' registration of each segmentation slice to the mean segmentation ...', self.param.verbose, 'normal')\n current_mean_seg = self.find_coregistration(mean_seg=current_mean_seg, transfo_type=transfo)\n\n resulting_mean_seg = current_mean_seg\n\n return resulting_mean_seg", "metadata": "root.ModelDictionaryBySlice.seg_coregistration", "header": "['class', 'ModelDictionaryBySlice', ':', '___EOS___']", "index": 931 }, { "content": " def find_coregistration(self, mean_seg=None, transfo_type='Rigid', first=True):\n \"\"\"\n For each segmentation slice, apply and save a registration of the specified type of transformation\n the name of the registration file (usually a matlab matrix) is saved in self.RtoM\n\n :param mean_seg: current mean segmentation\n\n :param transfo_type: type of transformation for the registration\n\n :return mean seg: updated mean segmentation\n \"\"\"\n\n if self.param.seg_type == 'gm-model':\n # Coregistraion of the gray matter segmentations\n for dic_slice in self.slices:\n name_j_transform = 'transform_slice_' + str(dic_slice.id) + find_ants_transfo_name(transfo_type)[0]\n new_reg_list = dic_slice.reg_to_M.append(name_j_transform)\n dic_slice.set(reg_to_m=new_reg_list)\n\n if first:\n seg_m = apply_ants_transfo(mean_seg, dic_slice.gm_seg, transfo_name=name_j_transform, path=self.model_dic_name + '/', transfo_type=transfo_type)\n else:\n seg_m = apply_ants_transfo(mean_seg, dic_slice.gm_seg_M, transfo_name=name_j_transform, path=self.model_dic_name + '/', transfo_type=transfo_type)\n\n dic_slice.set(gm_seg_m=seg_m.astype(int))\n dic_slice.set(gm_seg_m_flat=seg_m.flatten().astype(int))\n\n mean_seg = compute_majority_vote_mean_seg([dic_slice.gm_seg_M for dic_slice in self.slices])\n\n else:\n # Coregistraion of the white matter segmentations\n for dic_slice in self.slices:\n name_j_transform = 'transform_slice_' + str(dic_slice.id) + find_ants_transfo_name(transfo_type)[0]\n new_reg_list = dic_slice.reg_to_M.append(name_j_transform)\n dic_slice.set(reg_to_m=new_reg_list)\n\n if first:\n seg_m = apply_ants_transfo(mean_seg, dic_slice.wm_seg, transfo_name=name_j_transform, path=self.model_dic_name + '/', transfo_type=transfo_type)\n else:\n seg_m = apply_ants_transfo(mean_seg, dic_slice.wm_seg_M, transfo_name=name_j_transform, path=self.model_dic_name + '/', transfo_type=transfo_type)\n dic_slice.set(wm_seg_m=seg_m.astype(int))\n dic_slice.set(wm_seg_m_flat=seg_m.flatten().astype(int))\n\n mean_seg = compute_majority_vote_mean_seg([dic_slice.wm_seg_M for dic_slice in self.slices])\n\n save_image(mean_seg, 'mean_seg', path=self.model_dic_name+'/', im_type='uint8')\n return mean_seg", "metadata": "root.ModelDictionaryBySlice.find_coregistration", "header": "['class', 'ModelDictionaryBySlice', ':', '___EOS___']", "index": 957 }, { "content": " def compute_mean_dic_image(self, im_data_set):\n \"\"\"\n Compute the mean image of the dictionary\n\n Used to co-register the dictionary images into teh common groupwise space\n\n :param im_data_set:\n :return mean: mean image of the input data set\n \"\"\"\n mean = np.sum(im_data_set, axis=0)\n\n mean /= float(self.J)\n\n return mean", "metadata": "root.ModelDictionaryBySlice.compute_mean_dic_image", "header": "['class', 'ModelDictionaryBySlice', ':', '___EOS___']", "index": 1006 }, { "content": " def coregister_data(self, transfo_to_apply=None):\n \"\"\"\n Apply to each image slice of the dictionary the transformations found registering the segmentation slices.\n The co_registered images are saved for each slice as im_M\n\n :param transfo_to_apply: list of string\n :return:\n \"\"\"\n list_im = [dic_slice.im for dic_slice in self.slices]\n list_gm_seg = [dic_slice.gm_seg for dic_slice in self.slices]\n\n for dic_slice in self.slices:\n for n_transfo, transfo in enumerate(transfo_to_apply):\n im_m = apply_ants_transfo(self.compute_mean_dic_image(list_im), dic_slice.im, search_reg=False, transfo_name=dic_slice.reg_to_M[n_transfo], binary=False, path=self.model_dic_name+'/', transfo_type=transfo)\n # apply_2D_rigid_transformation(self.im[j], self.RM[j]['tx'], self.RM[j]['ty'], self.RM[j]['theta'])\n if self.param.seg_type == 'gm':\n gm_seg_m = apply_ants_transfo(self.compute_mean_dic_image(list_gm_seg), dic_slice.gm_seg, search_reg=False, transfo_name=dic_slice.reg_to_M[n_transfo], binary=False, path=self.model_dic_name+'/', transfo_type=transfo)\n\n dic_slice.set(im_m=im_m)\n dic_slice.set(im_m_flat=im_m.flatten())\n if self.param.seg_type == 'gm':\n dic_slice.set(gm_seg_m=gm_seg_m)\n dic_slice.set(gm_seg_m_flat=gm_seg_m.flatten())", "metadata": "root.ModelDictionaryBySlice.coregister_data", "header": "['class', 'ModelDictionaryBySlice', ':', '___EOS___']", "index": 1022 }, { "content": " def load_model_dictionary(self):\n \"\"\"\n Load the model dictionary from a saved one\n \"\"\"\n import itertools\n\n sct.printv('\\nLoading the model dictionary ...', self.param.verbose, 'normal')\n\n j_im = 0\n j_seg = 0\n j_im_m = 0\n j_seg_m = 0\n\n for subject_dir in os.listdir(self.model_dic_name):\n subject_path = self.model_dic_name + '/' + subject_dir\n if os.path.isdir(subject_path) and 'transformations' not in subject_path:\n\n for file_name in os.listdir(subject_path):\n if '_im.nii' in file_name:\n reg_list = ['transform_slice_' + str(j_im) + find_ants_transfo_name(transfo_type)[0]\n for transfo_type in self.coregistration_transfos]\n\n slice_level = 0\n name_list = file_name.split('_')\n for word in name_list:\n if word in self.level_label.values():\n slice_level = get_key_from_val(self.level_label, word)\n\n self.slices.append(Slice(slice_id=j_im, im=Image(subject_path + '/' + file_name).data,\n level=slice_level, reg_to_m=reg_list))\n j_im += 1\n\n if '_seg.nii' in file_name:\n self.slices[j_seg].set(seg=Image(subject_path + '/' + file_name).data)\n j_seg += 1\n\n if '_im_model_space.nii' in file_name:\n im_m_slice = Image(subject_path + '/' + file_name).data\n self.slices[j_im_m].set(im_m=im_m_slice, im_m_flat=im_m_slice.flatten())\n j_im_m += 1\n\n if '_seg_model_space.nii' in file_name:\n seg_m_slice = Image(subject_path + '/' + file_name).data\n self.slices[j_seg_m].set(seg_m=seg_m_slice, seg_m_flat=seg_m_slice.flatten())\n j_seg_m += 1\n\n # number of atlases in the dictionary\n self.J = len(self.slices) # len([slice.im for slice in self.slices])\n\n # dimension of the data (flatten slices)\n self.N = len(self.slices[0].im_M.flatten())\n\n self.mean_image = Image(self.model_dic_name + '/mean_image.nii.gz').data\n self.mean_seg = Image(self.model_dic_name + '/mean_seg.nii.gz').data", "metadata": "root.ModelDictionaryBySlice.load_model_dictionary", "header": "['class', 'ModelDictionaryBySlice', ':', '___EOS___']", "index": 1051 }, { "content": " def show_data(self):\n \"\"\"\n show the 10 first slices of the model dictionary\n \"\"\"\n for dic_slice in self.slices[:10]:\n fig = plt.figure()\n\n seg_subplot = fig.add_subplot(2, 3, 1)\n seg_subplot.set_title('Original space - seg')\n im_seg = seg_subplot.imshow(dic_slice.wm_seg)\n im_seg.set_interpolation('nearest')\n im_seg.set_cmap('gray')\n\n seg_m_subplot = fig.add_subplot(2, 3, 2)\n seg_m_subplot.set_title('Common groupwise space - seg')\n im_seg_m = seg_m_subplot.imshow(dic_slice.wm_seg_M)\n im_seg_m.set_interpolation('nearest')\n im_seg_m.set_cmap('gray')\n\n mean_seg_subplot = fig.add_subplot(2, 3, 3)\n mean_seg_subplot.set_title('Mean seg')\n im_mean_seg = mean_seg_subplot.imshow(np.asarray(self.mean_seg))\n im_mean_seg.set_interpolation('nearest')\n im_mean_seg.set_cmap('gray')\n\n slice_im_subplot = fig.add_subplot(2, 3, 4)\n slice_im_subplot.set_title('Original space - data ')\n im_slice_im = slice_im_subplot.imshow(dic_slice.im)\n im_slice_im.set_interpolation('nearest')\n im_slice_im.set_cmap('gray')\n\n slice_im_m_subplot = fig.add_subplot(2, 3, 5)\n slice_im_m_subplot.set_title('Common groupwise space - data ')\n im_slice_im_m = slice_im_m_subplot.imshow(dic_slice.im_M)\n im_slice_im_m.set_interpolation('nearest')\n im_slice_im_m.set_cmap('gray')\n\n plt.suptitle('Slice ' + str(dic_slice.id))\n plt.show()", "metadata": "root.ModelDictionaryBySlice.show_data", "header": "['class', 'ModelDictionaryBySlice', ':', '___EOS___']", "index": 1107 }, { "content": "class Model:\n \"\"\"\n Model used by the supervised gray matter segmentation method\n\n \"\"\"\n\n # ----------------------------------------------------------------------------------------------------------------------", "metadata": "root.Model", "header": "['module', '___EOS___']", "index": 1150 }, { "content": " def __init__(self, model_param=None, dictionary=None, k=0.8):\n \"\"\"\n Model constructor\n\n :param model_param: model parameters, type: Param\n\n :param dictionary: type: ModelDictionary\n\n :param k: Amount of variability to keep in the PCA reduced space, type: float\n \"\"\"\n if model_param is None:\n if dictionary is not None:\n self.param = dictionary.param\n else:\n self.param = Param()\n else:\n self.param = model_param\n\n self.dictionary = dictionary\n\n sct.printv(\"The shape of the dictionary used for the PCA is \"\n \"(\" + str(self.dictionary.N) + \",\" + str(self.dictionary.J) + \")\", verbose=self.param.verbose)\n\n # Instantiate a PCA object given the dictionary just build\n sct.printv('\\nCreating a reduced common space (using a PCA) ...', self.param.verbose, 'normal')\n\n if self.param.todo_model == 'compute':\n # creation of a PCA\n self.pca = PCA(np.asarray(self.dictionary.slices), k=k)\n # updating the dictionary mean_image \n self.dictionary.mean_image = self.pca.mean_image\n\n save_image(self.pca.mean_image, 'mean_image', path=self.dictionary.model_dic_name+'/')\n # saving the PCA data into a text file\n self.pca.save_data(self.dictionary.model_dic_name)\n\n elif self.param.todo_model == 'load':\n # loading PCA data from file\n pca_mean_data, pca_eig_pairs = self.load_pca_file()\n\n # creation of a PCA from the loaded data\n self.pca = PCA(np.asarray(self.dictionary.slices), mean_vect=pca_mean_data, eig_pairs=pca_eig_pairs, k=k)\n if self.param.verbose == 2:\n self.pca.plot_projected_dic()", "metadata": "root.Model.__init__", "header": "['class', 'Model', ':', '___EOS___']", "index": 1155 }, { "content": " def load_pca_file(self, file_name='data_pca.txt'):\n \"\"\"\n Load a PCA from a text file containing the appropriate information (previously saved)\n\n :param file_name: name of the PCA text file\n \"\"\"\n fic_data_pca = open(self.param.path_dictionary + '/' + file_name, 'r')\n mean_data_list = fic_data_pca.readline().split(',')\n eig_pairs_list = fic_data_pca.readline().split(',')\n fic_data_pca.close()\n\n mean_data_vect = []\n for val in mean_data_list:\n mean_data_vect.append([float(val)])\n mean_data_vect = np.asarray(mean_data_vect)\n\n eig_pairs_vect = []\n for pair in eig_pairs_list:\n eig_val_str, eig_vect_str = pair.split(';')\n eig_vect_str = eig_vect_str.split(' ')\n # eig_vect_str[-1] = eig_vect_str[-1][:-1]\n eig_vect = []\n for i, v in enumerate(eig_vect_str):\n if v != '' and v != '\\n':\n eig_vect.append(float(v))\n eig_pairs_vect.append((float(eig_val_str), eig_vect))\n\n return mean_data_vect, eig_pairs_vect", "metadata": "root.Model.load_pca_file", "header": "['class', 'Model', ':', '___EOS___']", "index": 1201 }, { "content": "class TargetSegmentationPairwise:\n \"\"\"\n Contains all the function to segment the gray matter an a target image given a model\n\n - registration of the target to the model space\n\n - projection of the target slices on the reduced model space\n\n - selection of the model slices most similar to the target slices\n\n - computation of the resulting target segmentation by label fusion of their segmentation\n \"\"\"\n\n # ------------------------------------------------------------------------------------------------------------------\n\n # ------------------------------------------------------------------------------------------------------------------\n\n # ------------------------------------------------------------------------------------------------------------------\n\n '''\n # ------------------------------------------------------------------------------------------------------------------\n def select_k_slices_old(self, beta, poped=None):\n \"\"\"\n Select the K dictionary slices most similar to the target slice\n\n :param beta: Dictionary similarities\n\n :return selected: numpy array of index of the selected dictionary slices\n \"\"\"\n selected = []\n\n slices_index = range(self.model.dictionary.J)\n if poped is not None:\n slices_index.pop(poped)\n\n if isinstance(beta[0], (list, np.ndarray)):\n for beta_slice in beta:\n selected_by_slice = []\n for j, beta_j in zip(slices_index, beta_slice):\n if beta_j > self.epsilon:\n selected_by_slice.append(j)\n # selected.append(np.asarray(selected_by_slice))\n selected.append(selected_by_slice)\n else:\n for j, beta_j in zip(slices_index, beta):\n if beta_j > self.epsilon:\n selected.append(j)\n\n return np.asarray(selected)\n\n def label_fusion_old(self, selected_slices):\n \"\"\"\n Compute the resulting segmentation by label fusion of the segmentation of the selected dictionary slices\n\n :param selected_slices: array of indexes of the selected dictionary slices\n\n :return res_seg_model_space: Image of the resulting segmentation for the target image (in the model space)\n \"\"\"\n res_seg_model_space = []\n\n if isinstance(selected_slices[0], (list, np.ndarray)):\n for i_target, selected_by_slice in enumerate(selected_slices):\n kept_slices_segmentation = []\n for j in selected_by_slice:\n kept_slices_segmentation.append(self.model.dictionary.slices[j].seg_M)\n slice_seg = compute_majority_vote_mean_seg(kept_slices_segmentation)\n res_seg_model_space.append(slice_seg)\n else:\n kept_slices_segmentation = []\n for j in selected_slices:\n kept_slices_segmentation.append(self.model.dictionary.slices[j].seg_M)\n slice_seg = compute_majority_vote_mean_seg(kept_slices_segmentation)\n res_seg_model_space = slice_seg\n\n res_seg_model_space = np.asarray(res_seg_model_space)\n # save_image(res_seg_model_space, 'res_GM_seg_model_space')\n\n return Image(res_seg_model_space)\n '''\n\n # ------------------------------------------------------------------------------------------------------------------\n\n\n # ------------------------------------------------------------------------------------------------------------------\n\n '''\n # ------------------------------------------------------------------------------------------------------------------\n def majority_vote_segmentation(self):\n \"\"\"\n Mean segmentation using only the slices of the same level in the dictionary\n \"\"\"\n target_seg = []\n for target_slice in self.target:\n dataset_by_level = []\n for dic_slice in self.model.dictionary.slices:\n if dic_slice.level == target_slice.level:\n dataset_by_level.append(dic_slice.seg_M)\n if dataset_by_level:\n target_slice_seg = compute_majority_vote_mean_seg(dataset_by_level, threshold=0.5)\n Image(param=target_slice_seg, absolutepath='target_gm_seg_slice' + str(target_slice.id) + '.nii.gz').save()\n target_seg.append(target_slice_seg)\n else:\n target_seg.append(np.zeros(target_slice.im.shape))\n Image(param=np.asarray(target_seg), absolutepath='target_gm_seg.nii.gz').save()\n '''\n\n '''\n # ------------------------------------------------------------------------------------------------------------------\n def show_projected_target(self):\n # Retrieving projected image from the mean image & its coordinates\n import copy\n\n index = 0\n fig1 = plt.figure()\n fig2 = plt.figure()\n # loop across all the projected slices coord\n for coord in self.coord_projected_target:\n img_reducted = copy.copy(self.model.pca.mean_data_vect)\n # loop across coord and build projected image\n for i in range(0, coord.shape[0]):\n img_reducted += int(coord[i][0]) * self.model.pca.kept_modes.T[i].reshape(self.model.pca.N, 1)\n\n if self.model.param.split_data:\n n = int(sqrt(self.model.pca.N * 2))\n else:\n n = int(sqrt(self.model.pca.N))\n\n # Plot original image\n orig_ax = fig1.add_subplot(10, 3, index)\n orig_ax.set_title('original slice {} '.format(index))\n if self.model.param.split_data:\n imgplot = orig_ax.imshow(self.target.data[index, :, :].reshape(n / 2, n))\n else:\n imgplot = orig_ax.imshow(self.target.data[index].reshape(n, n))\n imgplot.set_interpolation('nearest')\n imgplot.set_cmap('gray')\n # plt.title('Original Image')\n # plt.show()\n\n index += 1\n # Plot projected image image\n proj_ax = fig2.add_subplot(10, 3, index)\n proj_ax.set_title('slice {} projected'.format(index))\n if self.model.param.split_data:\n imgplot = proj_ax.imshow(img_reducted.reshape(n / 2, n))\n #imgplot = plt.imshow(img_reducted.reshape(n / 2, n))\n else:\n # imgplot = plt.imshow(img_reducted.reshape(n, n))\n imgplot = proj_ax.imshow(img_reducted.reshape(n, n))\n imgplot.set_interpolation('nearest')\n imgplot.set_cmap('gray')\n # plt.title('Projected Image')\n # plt.show()\n plt.show()\n '''", "metadata": "root.TargetSegmentationPairwise", "header": "['module', '___EOS___']", "index": 1233 }, { "content": " def __init__(self, model, target_image=None, levels_image=None, tau=None):\n \"\"\"\n Target gray matter segmentation constructor\n\n :param model: Model used to compute the segmentation, type: Model\n\n :param target_image: Target image to segment gray matter on, type: Image\n\n :param tau: Weighting parameter associated with the geodesic distances in the model dictionary, type: float\n \"\"\"\n self.model = model\n\n # Get the target image\n if len(target_image.data.shape) == 3:\n self.target = [Slice(slice_id=i_slice, im=target_slice) for i_slice, target_slice in enumerate(target_image.data)]\n elif len(target_image.data.shape) == 2:\n self.target = [Slice(slice_id=0, im=target_image.data)]\n\n # if levels_image is not None:\n if isinstance(levels_image, Image):\n nz_coord = levels_image.getNonZeroCoordinates()\n for i_level_slice, level_slice in enumerate(levels_image.data):\n nz_val = []\n for coord in nz_coord:\n if coord.x == i_level_slice:\n nz_val.append(level_slice[coord.y, coord.z])\n try:\n self.target[i_level_slice].set(level=int(round(sum(nz_val)/len(nz_val))))\n except ZeroDivisionError:\n sct.printv('No level label for slice ' + str(i_level_slice) + ' of target')\n self.target[i_level_slice].set(level=0)\n elif isinstance(levels_image, str):\n self.target[0].set(level=get_key_from_val(self.model.dictionary.level_label, levels_image))\n\n # self.majority_vote_segmentation()\n\n # self.target_M = self.target_pairwise_registration()\n self.target_pairwise_registration()\n\n # coord_projected_target is a list of all the coord of the target's projected slices\n sct.printv('\\nProjecting the target image in the reduced common space ...', model.param.verbose, 'normal')\n # self.coord_projected_target = model.pca.project(self.target_M) if self.target_M is not None else None\n self.coord_projected_target = model.pca.project([target_slice.im_M for target_slice in self.target])\n\n self.epsilon = round(1.0/self.model.dictionary.J, 4)/2\n print 'epsilon : ', self.epsilon\n\n if tau is None:\n self.tau = self.compute_tau()\n else:\n self.tau = tau\n\n if levels_image is not None:\n self.beta = self.compute_beta(self.coord_projected_target, target_levels=np.asarray([target_slice.level for target_slice in self.target]), tau=self.tau)\n else:\n self.beta = self.compute_beta(self.coord_projected_target, tau=self.tau)\n\n sct.printv('\\nSelecting the dictionary slices most similar to the target ...', model.param.verbose, 'normal')\n\n self.selected_k_slices = self.select_k_slices(self.beta)\n\n slice_levels = np.asarray([self.model.dictionary.level_label[dic_slice.level] for dic_slice in self.model.dictionary.slices])\n fic_selected_slices = open('selected_slices.txt', 'w')\n fic_selected_slices.write(str(slice_levels[self.selected_k_slices.reshape(self.model.dictionary.J,)]))\n fic_selected_slices.close()\n\n sct.printv('\\nComputing the result gray matter segmentation ...', model.param.verbose, 'normal')\n # self.target_GM_seg_M = self.label_fusion(self.selected_k_slices)\n self.label_fusion(self.selected_k_slices)\n\n sct.printv('\\nRegistering the result gray matter segmentation back into the target original space...',\n model.param.verbose, 'normal')\n self.target_pairwise_registration(inverse=True)", "metadata": "root.TargetSegmentationPairwise.__init__", "header": "['class', 'TargetSegmentationPairwise', ':', '___EOS___']", "index": 1245 }, { "content": " def target_pairwise_registration(self, inverse=False):\n \"\"\"\n Register the target image into the model space\n\n Affine (or rigid + affine) registration of the target on the mean model image --> pairwise\n\n :param inverse: if True, apply the inverse warping field of the registration target -> model space\n to the result gray matter segmentation of the target\n (put it back in it's original space)\n \"\"\"\n if not inverse:\n # Registration target --> model space\n target_model_space = []\n mean_dic_im = self.model.pca.mean_image\n for i, target_slice in enumerate(self.target):\n moving_target_slice = target_slice.im\n for transfo in self.model.dictionary.coregistration_transfos:\n transfo_name = transfo + '_transfo_target2model_space_slice_' + str(i) + find_ants_transfo_name(transfo)[0]\n\n moving_target_slice = apply_ants_transfo(mean_dic_im, moving_target_slice, binary=False, transfo_type=transfo, transfo_name=transfo_name)\n self.target[i].set(im_m=moving_target_slice)\n # target_model_space.append(moving_target_slice)\n # return Image(param=np.asarray(target_model_space))\n else:\n # Inverse registration result in model space --> target original space\n res_seg = []\n # mean_dic_im = self.model.pca.mean_image\n\n # for i, slice_M in enumerate(self.target_GM_seg_M.data):\n for i, target_slice in enumerate(self.target):\n if self.model.param.seg_type == 'wm':\n moving_seg_slice = target_slice.wm_seg_M\n else:\n moving_seg_slice = target_slice.gm_seg_M\n\n for transfo in self.model.dictionary.coregistration_transfos:\n transfo_name = transfo + '_transfo_target2model_space_slice_' + str(i) + find_ants_transfo_name(transfo)[0]\n moving_seg_slice = apply_ants_transfo(self.model.dictionary.mean_seg, moving_seg_slice, search_reg=False, binary=True, inverse=1, transfo_type=transfo, transfo_name=transfo_name)\n\n if self.model.param.seg_type == 'wm':\n target_slice.set(wm_seg=moving_seg_slice)\n else:\n target_slice.set(gm_seg=moving_seg_slice)\n # res_seg.append(moving_seg_slice)\n # return Image(param=np.asarray(res_seg))", "metadata": "root.TargetSegmentationPairwise.target_pairwise_registration", "header": "['class', 'TargetSegmentationPairwise', ':', '___EOS___']", "index": 1320 }, { "content": " def compute_beta(self, coord_target, target_levels=None, dataset_coord=None, dataset_levels=None, tau=0.01):\n \"\"\"\n Compute the model similarity (beta) between each model slice and each target image slice\n\n beta_j = (1/Z)exp(-tau*square_norm(target_coordinate - slice_j_coordinate))\n\n Z is the partition function that enforces the constraint that sum(beta)=1\n\n :param coord_target: coordinates of the target image in the reduced model space\n\n :param tau: weighting parameter indicating the decay constant associated with a geodesic distance\n between a given dictionary slice and a projected target image slice\n\n :return:\n \"\"\"\n if dataset_coord is None:\n # in the dataset_coord matrix, each column correspond to the projection of one of the original data image,\n # the transpose operator .T enable the loop to iterate over all the images coord\n dataset_coord = self.model.pca.dataset_coord.T\n dataset_levels = [dic_slice.level for dic_slice in self.model.dictionary.slices]\n\n beta = []\n\n # TODO: SEE IF WE NEED TO CHECK THE SECOND DIMENSION OF COORD TARGET OR THE FIRST ...\n if isinstance(coord_target[0], (list, np.ndarray)):\n for i_target, coord_projected_slice in enumerate(coord_target):\n beta_slice = []\n for j_slice, coord_slice_j in enumerate(dataset_coord):\n square_norm = np.linalg.norm((coord_projected_slice - coord_slice_j), 2)\n if target_levels is not None:\n if target_levels[i_target] == dataset_levels[j_slice]:\n beta_slice.append(exp(tau*square_norm))\n else:\n beta_slice.append(exp(-tau*square_norm)/1.2*(target_levels[i_target] - dataset_levels[j_slice]))\n else:\n beta_slice.append(exp(tau*square_norm))\n\n try:\n beta_slice /= np.sum(beta_slice)\n except ZeroDivisionError:\n sct.printv('WARNING : similarities are null', self.model.param.verbose, 'warning')\n print beta_slice\n\n beta.append(beta_slice)\n else:\n for j_slice, coord_slice_j in enumerate(dataset_coord):\n square_norm = np.linalg.norm((coord_target - coord_slice_j), 2)\n if target_levels is not None:\n if target_levels == dataset_levels[j_slice]:\n beta.append(exp(tau*square_norm))\n else:\n beta.append(exp(-tau*square_norm)/1.2*(target_levels - dataset_levels[j_slice]))\n else:\n beta.append(exp(tau*square_norm))\n\n try:\n beta /= np.sum(beta)\n except ZeroDivisionError:\n sct.printv('WARNING : similarities are null', self.model.param.verbose, 'warning')\n print beta\n\n return np.asarray(beta)", "metadata": "root.TargetSegmentationPairwise.compute_beta", "header": "['class', 'TargetSegmentationPairwise', ':', '___EOS___']", "index": 1367 }, { "content": " def compute_tau(self):\n \"\"\"\n Compute the weighting parameter indicating the decay constant associated with a geodesic distance\n between a given dictionary slice and a projected target image slice\n :return:\n \"\"\"\n sct.printv('\\nComputing Tau ... \\n'\n '(Tau is a weighting parameter indicating the decay constant associated with a geodesic distance between a given atlas and a projected target image, see Asman paper, eq (16))', 1, 'normal')\n from scipy.optimize import minimize\n\n def to_minimize(tau):\n \"\"\"\n Compute the sum of the L0 norm between a slice segmentation and the resulting segmentation that would be\n found if the slice was a target image for a given tau\n\n For a given model, Tau is the parameter that would minimize this function\n\n :param tau:\n\n :return sum_norm:\n\n \"\"\"\n sum_norm = 0\n for dic_slice in self.model.dictionary.slices:\n projected_dic_slice_coord = self.model.pca.project_array(dic_slice.im_M_flat)\n coord_dic_slice_dataset = np.delete(self.model.pca.dataset_coord.T, dic_slice.id, 0)\n dic_slice_dataset_levels = np.delete(np.asarray(dic_levels), dic_slice.id, 0)\n beta_dic_slice = self.compute_beta(projected_dic_slice_coord, target_levels=dic_slice.level, dataset_coord=coord_dic_slice_dataset, dataset_levels=dic_slice_dataset_levels, tau=tau)\n kj = self.select_k_slices(beta_dic_slice) # , poped=dic_slice.id)\n est_segm_j = self.label_fusion(kj)\n\n if self.model.param.seg_type == 'wm':\n sum_norm += l0_norm(dic_slice.wm_seg_M, est_segm_j.data)\n else:\n sum_norm += l0_norm(dic_slice.gm_seg_M, est_segm_j.data)\n return sum_norm\n\n dic_levels = [dic_slice.level for dic_slice in self.model.dictionary.slices]\n\n est_tau = minimize(to_minimize, 0.001, method='Nelder-Mead', options={'xtol': 0.0005})\n sct.printv('Estimated tau : ' + str(est_tau.x[0]))\n if self.model.param.todo_model == 'compute':\n fic = open(self.model.dictionary.model_dic_name + '/tau.txt', 'w')\n fic.write(str(est_tau.x[0]))\n fic.close()\n return float(est_tau.x[0])", "metadata": "root.TargetSegmentationPairwise.compute_tau", "header": "['class', 'TargetSegmentationPairwise', ':', '___EOS___']", "index": 1431 }, { "content": " def select_k_slices(self, beta):\n \"\"\"\n Select the K dictionary slices most similar to the target slice\n\n :param beta: Dictionary similarities\n\n :return selected: numpy array of segmentation of the selected dictionary slices\n \"\"\"\n\n kept_slice_index = []\n\n if isinstance(beta[0], (list, np.ndarray)):\n for beta_slice in beta:\n selected_index = beta_slice > self.epsilon\n '''\n if poped is not None:\n selected_index = np.delete(selected_index, poped)\n '''\n # kept_seg_slices.append(segmentation_slices[selected_index])\n kept_slice_index.append(selected_index)\n\n else:\n kept_slice_index = beta > self.epsilon\n '''\n if poped is not None:\n selected_index = np.delete(selected_index, poped)\n '''\n # kept_seg_slices = segmentation_slices[selected_index]\n\n return np.asarray(kept_slice_index)", "metadata": "root.TargetSegmentationPairwise.select_k_slices", "header": "['class', 'TargetSegmentationPairwise', ':', '___EOS___']", "index": 1540 }, { "content": " def label_fusion(self, selected_index):\n \"\"\"\n Compute the resulting segmentation by label fusion of the segmentation of the selected dictionary slices\n\n :param selected_index: array of indexes (as a boolean array) of the selected dictionary slices\n\n :return res_seg_model_space: Image of the resulting segmentation for the target image (in the model space)\n \"\"\"\n if self.model.param.seg_type == 'wm':\n segmentation_slices = np.asarray([dic_slice.wm_seg_M for dic_slice in self.model.dictionary.slices])\n else:\n segmentation_slices = np.asarray([dic_slice.gm_seg_M for dic_slice in self.model.dictionary.slices])\n\n res_seg_model_space = []\n '''\n print '---------- IN LABEL_FUSION : shape selected_k_slices ---------------->', selected_k_slices.shape,\n ' len = ', len(selected_k_slices.shape)\n print '---------- IN LABEL_FUSION : type selected_k_slices[0] ---------------->', type(selected_k_slices[0])\n '''\n # if isinstance(selected_slices[0][0][0], (list, np.ndarray)):\n # if len(selected_slices[0].shape) == 3:\n if isinstance(selected_index[0], (list, np.ndarray)):\n\n for i, selected_ind_by_slice in enumerate(selected_index): # selected_slices:\n slice_seg = compute_majority_vote_mean_seg(segmentation_slices[selected_ind_by_slice])\n res_seg_model_space.append(slice_seg)\n if self.model.param.seg_type == 'wm':\n self.target[i].set(wm_seg_m=slice_seg)\n else:\n self.target[i].set(gm_seg_m=slice_seg)\n # res_seg_model_space = map(compute_majority_vote_mean_seg, selected_slices)\n\n else:\n # res_seg_model_space = compute_majority_vote_mean_seg(selected_slices)\n res_seg_model_space = compute_majority_vote_mean_seg(segmentation_slices[selected_index])\n\n res_seg_model_space = np.asarray(res_seg_model_space)\n # save_image(res_seg_model_space, 'res_GM_seg_model_space')\n\n return Image(param=res_seg_model_space)", "metadata": "root.TargetSegmentationPairwise.label_fusion", "header": "['class', 'TargetSegmentationPairwise', ':', '___EOS___']", "index": 1571 }, { "content": " def plot_projected_dic(self, nb_modes=3):\n \"\"\"\n plot the pca first modes and the target projection if target is provided.\n\n on a second plot, highlight the selected dictionary slices for one target slice in particular\n\n :param nb_modes:\n :return:\n \"\"\"\n self.model.pca.plot_projected_dic(nb_mode=nb_modes, target_coord=self.coord_projected_target) if self.coord_projected_target is not None \\\n else self.model.pca.plot_projected_dic()\n\n self.model.pca.plot_projected_dic(nb_mode=nb_modes, target_coord=self.coord_projected_target, to_highlight=(5, self.selected_k_slices[5])) if self.coord_projected_target is not None \\\n else self.model.pca.plot_projected_dic()", "metadata": "root.TargetSegmentationPairwise.plot_projected_dic", "header": "['class', 'TargetSegmentationPairwise', ':', '___EOS___']", "index": 1613 }, { "content": "class TargetSegmentationGroupwise:\n \"\"\"\n Contains all the function to segment the gray matter an a target image given a model\n\n - registration of the target to the model space\n\n - projection of the target slices on the reduced model space\n\n - selection of the model slices most similar to the target slices\n\n - computation of the resulting target segmentation by label fusion of their segmentation\n \"\"\"\n\n # ------------------------------------------------------------------------------------------------------------------\n\n # ------------------------------------------------------------------------------------------------------------------\n\n # ------------------------------------------------------------------------------------------------------------------\n\n # ------------------------------------------------------------------------------------------------------------------\n\n # ------------------------------------------------------------------------------------------------------------------\n\n # ------------------------------------------------------------------------------------------------------------------\n\n\n # ------------------------------------------------------------------------------------------------------------------", "metadata": "root.TargetSegmentationGroupwise", "header": "['module', '___EOS___']", "index": 1702 }, { "content": " def __init__(self, model, target_image=None, tau=None):\n \"\"\"\n Target gray matter segmentation constructor\n\n :param model: Model used to compute the segmentation, type: Model\n\n :param target_image: Target image to segment gray matter on, type: Image\n\n :param tau: Weighting parameter associated with the geodesic distances in the model dictionary, type: float\n \"\"\"\n self.model = model\n\n # Get the target image\n self.target = target_image\n '''\n save_image(self.target.data, 'target_image')\n print '---TARGET IMAGE IN CLASS TargetSegmentation : ', self.target.data\n save_image(self.target.data[0],'target_slice0_targetSeg_'+self.model.param.todo_model)\n '''\n self.epsilon = round(1.0/self.model.dictionary.J, 5) - 0.0001 # /2\n\n if tau is None:\n self.tau = self.compute_tau()\n else:\n self.tau = tau\n\n self.target_M, self.R_target_to_M = self.target_groupwise_registration()\n self.target_M.file_name = 'target_model_space'\n self.target_M.ext = '.nii.gz'\n # self.target_M.data = self.target_M.data.astype('float32')\n self.target_M.save()\n\n '''\n print '----- registered target ---- ', self.target_M.data\n save_image(self.target_M.data, 'target_image_model_space')\n save_image(self.target_M.data[0],'target_registered_slice0_rigidreg_'+self.model.param.todo_model)\n '''\n\n # coord_projected_target is a list of all the coord of the target's projected slices\n sct.printv('\\nProjecting the target image in the reduced common space ...', model.param.verbose, 'normal')\n self.coord_projected_target = model.pca.project(self.target_M) if self.target_M is not None else None\n\n '''\n print '----SHAPE COORD PROJECTED TARGET -----', self.coord_projected_target.shape\n print '----COORD PROJECTED TARGET -----', self.coord_projected_target\n '''\n\n self.beta = self.compute_beta(self.coord_projected_target, tau=self.tau)\n '''\n print '----------- BETAS :', self.beta\n self.beta = self.compute_beta(self.coord_projected_target, tau=0.00114)\n '''\n sct.printv('\\nSelecting the dictionary slices most similar to the target ...', model.param.verbose, 'normal')\n\n self.selected_k_slices = self.select_k_slices(self.beta)\n '''\n print '----SELECTED K -----', self.selected_k_slices\n print '----SHAPE SELECTED K -----', self.selected_k_slices.shape\n '''\n sct.printv('\\nComputing the result gray matter segmentation ...', model.param.verbose, 'normal')\n self.target_GM_seg_M = self.label_fusion(self.selected_k_slices)\n self.target_GM_seg_M.file_name = 'res_gmseg_model_space'\n self.target_GM_seg_M.ext = '.nii.gz'\n # self.target_M.data = self.target_M.data.astype('float32')\n self.target_GM_seg_M.save()\n sct.printv('\\nRegistering the result gray matter segmentation back into the target original space...',\n model.param.verbose, 'normal')\n self.target_GM_seg = self.target_groupwise_registration(inverse=True)", "metadata": "root.TargetSegmentationGroupwise.__init__", "header": "['class', 'TargetSegmentationGroupwise', ':', '___EOS___']", "index": 1714 }, { "content": " def compute_beta(self, coord_target, dataset_coord=None, tau=0.01):\n \"\"\"\n Compute the model similarity (beta) between each model slice and each target image slice\n\n beta_j = (1/Z)exp(-tau*square_norm(target_coordinate - slice_j_coordinate))\n\n Z is the partition function that enforces the constraint that sum(beta)=1\n\n :param coord_target: coordinates of the target image in the reduced model space\n\n :param tau: weighting parameter indicating the decay constant associated with a geodesic distance\n between a given dictionary slice and a projected target image slice\n\n :return:\n \"\"\"\n if dataset_coord is None:\n # in the dataset_coord matrix, each column correspond to the projection of one of the original data image,\n # the transpose operator .T enable the loop to iterate over all the images coord\n dataset_coord = self.model.pca.dataset_coord.T\n\n beta = []\n '''\n sct.printv('----------- COMPUTING BETA --------------', 1, 'info')\n print '------ TAU = ', tau\n print '---------- IN BETA : coord_target ---------------->', coord_target\n print '---------- IN BETA : shape coord_target ---------------->', coord_target.shape, ' len = ',\n len(coord_target.shape)\n print '---------- IN BETA : type coord_target[0][0] ---------------->', type(coord_target[0][0])\n '''\n # TODO: SEE IF WE NEED TO CHECK THE SECOND DIMENSION OF COORD TARGET OR THE FIRST ...\n if isinstance(coord_target[0], (list, np.ndarray)):\n for i_target, coord_projected_slice in enumerate(coord_target):\n beta_slice = []\n for coord_slice_j in dataset_coord:\n square_norm = np.linalg.norm((coord_projected_slice - coord_slice_j), 2)\n beta_slice.append(exp(-tau*square_norm))\n\n '''\n print 'beta case 1 :', beta\n print '--> sum beta ', Z\n '''\n try:\n if np.sum(beta_slice) != 0:\n beta_slice /= np.sum(beta_slice)\n except ZeroDivisionError:\n sct.printv('WARNING : similarities are null', self.model.param.verbose, 'warning')\n print beta_slice\n\n beta.append(beta_slice)\n else:\n for coord_slice_j in dataset_coord:\n square_norm = np.linalg.norm((coord_target - coord_slice_j), 2)\n beta.append(exp(-tau*square_norm))\n\n try:\n beta /= np.sum(beta)\n except ZeroDivisionError:\n sct.printv('WARNING : similarities are null', self.model.param.verbose, 'warning')\n print beta\n\n return np.asarray(beta)", "metadata": "root.TargetSegmentationGroupwise.compute_beta", "header": "['class', 'TargetSegmentationGroupwise', ':', '___EOS___']", "index": 1784 }, { "content": " def compute_tau(self):\n \"\"\"\n Compute the weighting parameter indicating the decay constant associated with a geodesic distance\n between a given dictionary slice and a projected target image slice\n :return:\n \"\"\"\n sct.printv('\\nComputing Tau ... \\n'\n '(Tau is a weighting parameter indicating the decay constant associated with a geodesic distance '\n 'between a given atlas and a projected target image, see Asman paper, eq (16))', 1, 'normal')\n from scipy.optimize import minimize\n\n def to_minimize(tau):\n \"\"\"\n Compute the sum of the L0 norm between a slice segmentation and the resulting segmentation that would be\n found if the slice was a target image for a given tau\n\n For a given model, Tau is the parameter that would minimize this function\n\n :param tau:\n\n :return sum_norm:\n\n \"\"\"\n sum_norm = 0\n for dic_slice in self.model.dictionary.slices:\n projected_dic_slice_coord = self.model.pca.project_array(dic_slice.im_M_flat)\n\n coord_dic_slice_dataset = np.delete(self.model.pca.dataset_coord.T, dic_slice.id, 0)\n\n beta_dic_slice = self.compute_beta(projected_dic_slice_coord, dataset_coord=coord_dic_slice_dataset,\n tau=tau)\n kj = self.select_k_slices(beta_dic_slice) # , poped=dic_slice.id)\n est_segm_j = self.label_fusion(kj)\n\n sum_norm += l0_norm(dic_slice.seg_M, est_segm_j.data)\n return sum_norm\n\n est_tau = minimize(to_minimize, 0, method='Nelder-Mead', options={'xtol': 0.0005})\n sct.printv('Estimated tau : ' + str(est_tau.x[0]))\n if self.model.param.todo_model == 'compute':\n fic = open(self.model.dictionary.model_dic_name + '/tau.txt', 'w')\n fic.write(str(est_tau.x[0]))\n fic.close()\n return float(est_tau.x[0])", "metadata": "root.TargetSegmentationGroupwise.compute_tau", "header": "['class', 'TargetSegmentationGroupwise', ':', '___EOS___']", "index": 1847 }, { "content": " def compute_mu(self, beta):\n \"\"\"\n Compute the weighted mean of the dictionary slices projection weights\n\n :param beta: similarities vector for one target slice\n\n :return mu:\n \"\"\"\n '''\n mu = []\n for beta_slice in beta:\n mu.append(self.model.pca.dataset_coord.dot(beta_slice))\n return np.asarray(mu)\n '''\n return self.model.pca.dataset_coord.dot(beta)", "metadata": "root.TargetSegmentationGroupwise.compute_mu", "header": "['class', 'TargetSegmentationGroupwise', ':', '___EOS___']", "index": 1893 }, { "content": " def compute_sigma(self, beta, mu):\n \"\"\"\n Compute the weighted standard deviation of the dictionary slices projection weights\n\n :param beta: similarities vector for one target slice\n\n :param mu: weighted mean of the dictionary slices projection weights for one target slice\n\n :return sigma:\n \"\"\"\n '''\n sigma = []\n for beta_slice, mu_slice in zip(beta, mu):\n\n sigma.append([beta_slice.dot((self.model.pca.dataset_coord[v, :] - mu_slice[v]) ** 2)\n for v in range(len(mu_slice))])\n\n return np.asarray(sigma)\n '''\n return np.asarray([beta.dot((self.model.pca.dataset_coord[v, :] - mu[v]) ** 2) for v in range(len(mu))])", "metadata": "root.TargetSegmentationGroupwise.compute_sigma", "header": "['class', 'TargetSegmentationGroupwise', ':', '___EOS___']", "index": 1910 }, { "content": " def target_groupwise_registration(self, inverse=False):\n \"\"\"\n Register the target image into the model space\n\n Affine (or rigid + affine) registration of the target on the mean model image --> pairwise\n\n :param inverse: if True, apply the inverse warping field of the registration target -> model space\n to the result gray matter segmentation of the target\n (put it back in it's original space)\n \"\"\"\n if not inverse:\n # Registration target --> model space\n from scipy.optimize import minimize\n\n # Initialisation\n target_m = []\n\n def to_minimize(t_param, n_slice):\n \"\"\"\n\n :param :\n\n :return sum_norm:\n\n \"\"\"\n moved_target_slice = Image(param=np.asarray(apply_2d_transformation(self.target.data[n_slice],\n tx=t_param[0], ty=t_param[1],\n theta=t_param[2],\n s=t_param[3])[0]))\n\n coord_moved_target = self.model.pca.project_array(moved_target_slice.data.flatten())\n coord_moved_target = coord_moved_target.reshape(coord_moved_target.shape[0],)\n\n beta = self.compute_beta(coord_moved_target, tau=self.tau)\n mu = self.compute_mu(beta)\n sigma = self.compute_sigma(beta, mu)\n\n target_th_slice = np.sum((np.asarray([dic_slice.im_M for dic_slice in self.model.dictionary.slices]).T\n * beta[n_slice]).T, axis=0)\n sq_norm = np.linalg.norm(target_th_slice - moved_target_slice.data, 2)**2\n\n gauss = np.sum(((coord_moved_target - mu)/sigma)**2)\n return sq_norm*gauss\n\n r_target_to_m = []\n for i_slice, target_slice in enumerate(self.target.data):\n x0 = [0, 0, 0, 1]\n est_transfo = minimize(to_minimize, x0, args=i_slice, method='Nelder-Mead', options={'xtol': 0.00005})\n target_m_slice, r_slice = apply_2d_transformation(target_slice, tx=est_transfo.x[0],\n ty=est_transfo.x[1], theta=est_transfo.x[2],\n s=est_transfo.x[3])\n print est_transfo.x\n target_m.append(target_m_slice)\n r_target_to_m.append(r_slice)\n return Image(param=np.asarray(target_m)), r_target_to_m\n\n else:\n # Inverse registration result in model space --> target original space\n moved_res = []\n for i_slice, res_m_slice in enumerate(self.target_GM_seg_M.data):\n moved_res.append(apply_2d_transformation(res_m_slice, transfo=self.R_target_to_M[i_slice].inverse)[0])\n return Image(np.asarray(moved_res).astype('uint8'))", "metadata": "root.TargetSegmentationGroupwise.target_groupwise_registration", "header": "['class', 'TargetSegmentationGroupwise', ':', '___EOS___']", "index": 1932 }, { "content": " def select_k_slices(self, beta):\n \"\"\"\n Select the K dictionary slices most similar to the target slice\n\n :param beta: Dictionary similarities\n\n :return selected: numpy array of segmentation of the selected dictionary slices\n \"\"\"\n\n kept_slice_index = []\n\n if isinstance(beta[0], (list, np.ndarray)):\n for beta_slice in beta:\n selected_index = beta_slice > self.epsilon\n '''\n if poped is not None:\n selected_index = np.delete(selected_index, poped)\n '''\n # kept_seg_slices.append(segmentation_slices[selected_index])\n kept_slice_index.append(selected_index)\n\n else:\n kept_slice_index = beta > self.epsilon\n '''\n if poped is not None:\n selected_index = np.delete(selected_index, poped)\n '''\n # kept_seg_slices = segmentation_slices[selected_index]\n\n return np.asarray(kept_slice_index)", "metadata": "root.TargetSegmentationGroupwise.select_k_slices", "header": "['class', 'TargetSegmentationGroupwise', ':', '___EOS___']", "index": 1996 }, { "content": " def label_fusion(self, selected_index):\n \"\"\"\n Compute the resulting segmentation by label fusion of the segmentation of the selected dictionary slices\n\n :param selected_index: array of indexes (as a boolean array) of the selected dictionary slices\n\n :return res_seg_model_space: Image of the resulting segmentation for the target image (in the model space)\n \"\"\"\n segmentation_slices = np.asarray([dic_slice.seg_M for dic_slice in self.model.dictionary.slices])\n\n res_seg_model_space = []\n\n # if isinstance(selected_slices[0][0][0], (list, np.ndarray)):\n # if len(selected_slices[0].shape) == 3:\n if isinstance(selected_index[0], (list, np.ndarray)):\n\n for selected_ind_by_slice in selected_index: # selected_slices:\n slice_seg = compute_majority_vote_mean_seg(segmentation_slices[selected_ind_by_slice], threshold=0.3)\n res_seg_model_space.append(slice_seg)\n # res_seg_model_space = map(compute_majority_vote_mean_seg, selected_slices)\n\n else:\n # res_seg_model_space = compute_majority_vote_mean_seg(selected_slices)\n res_seg_model_space = compute_majority_vote_mean_seg(segmentation_slices[selected_index], threshold=0.3)\n\n res_seg_model_space = np.asarray(res_seg_model_space)\n # save_image(res_seg_model_space, 'res_GM_seg_model_space')\n\n return Image(param=res_seg_model_space)", "metadata": "root.TargetSegmentationGroupwise.label_fusion", "header": "['class', 'TargetSegmentationGroupwise', ':', '___EOS___']", "index": 2027 }, { "content": " def plot_projected_dic(self, nb_modes=3):\n \"\"\"\n plot the pca first modes and the target projection if target is provided.\n\n on a second plot, highlight the selected dictionary slices for one target slice in particular\n\n :param nb_modes:\n :return:\n \"\"\"\n self.model.pca.plot_projected_dic(nb_mode=nb_modes, target_coord=self.coord_projected_target) if self.coord_projected_target is not None \\\n else self.model.pca.plot_projected_dic()\n\n self.model.pca.plot_projected_dic(nb_mode=nb_modes, target_coord=self.coord_projected_target, to_highlight=(6, self.selected_k_slices[6])) if self.coord_projected_target is not None \\\n else self.model.pca.plot_projected_dic()\n print self.selected_k_slices[6]", "metadata": "root.TargetSegmentationGroupwise.plot_projected_dic", "header": "['class', 'TargetSegmentationGroupwise', ':', '___EOS___']", "index": 2058 }, { "content": "class GMsegSupervisedMethod():\n \"\"\"\n Gray matter segmentation supervised method:\n\n Load a dictionary (training data set), compute or load a model from this dictionary\nsct_Image\n Load a target image to segment and do the segmentation using the model\n \"\"\"\n", "metadata": "root.GMsegSupervisedMethod", "header": "['module', '___EOS___']", "index": 2077 }, { "content": " def __init__(self, target_fname, gm_seg_param=None):\n\n self.dictionary = ModelDictionaryBySlice(dic_param=gm_seg_param)\n\n sct.printv('\\nBuilding the appearance model...', verbose=gm_seg_param.verbose, type='normal')\n # build the appearance model\n self.model = Model(model_param=gm_seg_param, dictionary=self.dictionary, k=0.8)\n\n sct.printv('\\nConstructing target image ...', verbose=gm_seg_param.verbose, type='normal')\n # construct target image\n self.target_image = Image(target_fname)\n\n tau = None # 0.000765625 # 0.00025 # 0.000982421875 # 0.00090625 # None\n\n if gm_seg_param.todo_model == 'load':\n fic = open(self.model.dictionary.model_dic_name + '/tau.txt', 'r')\n tau = float(fic.read())\n fic.close()\n\n # build a target segmentation\n levels_im = None\n if gm_seg_param.level_fname is not None:\n if isinstance(gm_seg_param.level_fname, str):\n # in this case the level is a string and not an image\n levels_im = gm_seg_param.level_fname\n else:\n levels_im = Image(gm_seg_param.level_fname)\n if gm_seg_param.target_reg == 'pairwise':\n if levels_im is not None:\n self.target_seg_methods = TargetSegmentationPairwise(self.model, target_image=self.target_image, levels_image=levels_im, tau=tau)\n else:\n self.target_seg_methods = TargetSegmentationPairwise(self.model, target_image=self.target_image, tau=tau)\n\n elif gm_seg_param.target_reg == 'groupwise':\n self.target_seg_methods = TargetSegmentationGroupwise(self.model, target_image=self.target_image, tau=tau)\n\n suffix = '_'\n suffix += gm_seg_param.target_reg\n suffix += gm_seg_param.seg_type\n for transfo in self.dictionary.coregistration_transfos:\n suffix += '_' + transfo\n if levels_im is not None:\n suffix += '_with_levels'\n else:\n suffix += '_no_levels'\n\n # save the result gray matter segmentation\n # self.res_GM_seg = self.target_seg_methods.target_GM_seg\n if gm_seg_param.seg_type == 'wm':\n if len(self.target_seg_methods.target) == 1:\n self.res = Image(param=np.asarray(self.target_seg_methods.target[0].wm_seg))\n else:\n self.res = Image(param=np.asarray([target_slice.wm_seg for target_slice in self.target_seg_methods.target]))\n else:\n if len(self.target_seg_methods.target) == 1:\n self.res = Image(param=np.asarray(self.target_seg_methods.target[0].gm_seg))\n else:\n self.res = Image(param=np.asarray([target_slice.gm_seg for target_slice in self.target_seg_methods.target]))\n\n name_res = sct.extract_fname(target_fname)[1] + '_graymatterseg' + suffix # TODO: remove suffix\n self.res.file_name = name_res\n self.res.ext = '.nii.gz'\n self.res.save()\n\n '''\n save_image(self.res_GM_seg.data, name_res)\n '''\n # inverse_wmseg_to_gmseg(self.res_GM_seg, self.target_image, name_res)\n\n sct.printv('Done! \\nTo see the result, type :')\n sct.printv('fslview ' + target_fname + ' ' + name_res + '.nii.gz -l Red -t 0.4 &', gm_seg_param.verbose, 'info')", "metadata": "root.GMsegSupervisedMethod.__init__", "header": "['class', 'GMsegSupervisedMethod', '(', ')', ':', '___EOS___']", "index": 2085 }, { "content": " def show(self):\n\n sct.printv('\\nShowing the pca modes ...')\n self.model.pca.show_all_modes()\n\n sct.printv('\\nPloting Omega ...')\n self.target_seg_methods.plot_projected_dic(nb_modes=3)\n\n sct.printv('\\nShowing PCA mode graphs ...')\n self.model.pca.show_mode_variation()\n print 'J :', self.dictionary.J\n\n '''\n sct.printv('\\nShowing the projected target ...')\n self.target_seg_methods.show_projected_target()\n '''", "metadata": "root.GMsegSupervisedMethod.show", "header": "['class', 'GMsegSupervisedMethod', '(', ')', ':', '___EOS___']", "index": 2157 } ]
[ { "span": "from math import sqrt", "start_line": 28, "start_column": 0, "end_line": 28, "end_column": 21 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "#########", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "As", "man", " ", "et", " ", "al", ".", " ", "group", "wis", "e", " ", "multi", "-", "atlas", " ", "segmentation", " ", "method", " ", "implementation_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2014", " ", "Poly", "technique", " ", "Mont", "real", " ", "<", "www", ".", "neuro", ".", "poly", "mt", "l", ".", "ca", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Author", "s", ":", " ", "August", "in", " ", "Rou", "x", ",", " ", "Sar", "a", " ", "Dup", "ont", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Modifie", "d", ":", " ", "201", "5", "-0", "3", "-", "24_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Abo", "ut", " ", "the", " ", "license", ":", " ", "see", " ", "the", " ", "file", " ", "LICENSE", ".", "TXT", "_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "#########", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "change", " ", "'", "target", "'", " ", "by", " ", "'", "input", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", ":", " ", "make", " ", "it", " ", "faste", "r_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "import", " ", "os_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "import", " ", "sys_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "import", " ", "nump", "y", " ", "as", " ", "np_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "import", " ", "mat", "plotlib", ".", "pypl", "ot", " ", "as", " ", "plt_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "msc", "t", "\\u", "pca_", "import_", "PCA", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "from", " ", "msc", "t", "\\u", "image", " ", "import", " ", "Image_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "from", " ", "msc", "t", "\\u", "parser", " ", "import", " ", "*_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "msc", "t", "\\u", "gm", "seg", "\\u", "utils_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sct", "\\u", "utils_", "as_", "sct", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "math_", "import_", "sqrt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "math_", "import_", "exp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "from", " ", "math", " ", "import", " ", "fabs_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "#########", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "-----------", " ", "Class", "es", " ", "--------------", "--------------", "--------------", "------------", " ", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "#########", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "MODEL", " ", "DICT", "ION", "ARY", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "---", "_", "\\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_", "#", " ", "MODEL", " ", "DICT", "ION", "ARY", " ", "SLI", "CE", " ", "BY", " ", "SLI", "CE", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "---", "_", "\\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_", "#", " ", "MODEL", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "-------------", "_", "\\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_", "#", " ", "TARGET", " ", "SEGMENT", "ATION", " ", "PAIR", "WI", "SE", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "-----", "_", "\\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_", "#", " ", "TARGET", " ", "SEGMENT", "ATION", " ", "GROU", "PW", "ISE", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "----", "_", "\\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_", "#", " ", "GRA", "Y", " ", "MAT", "TER", " ", "SEGMENT", "ATION", " ", "SUPER", "VIS", "ED", " ", "METH", "OD", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "-----", "_", "\\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_", "#", " ", "--------------", "--------------", "--------------", "------------", " ", " ", "MAIN", " ", "--------------", "--------------", "--------------", "-------------", " ", "#", "_", "\\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\\uINDENT\\u\\u\\u ", " _", "param_", "=_", "Param_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input", "\\u", "target", "\\u", "fname_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "param_", "._", "debug_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'\\\\", "n", "***", " ", "WARN", "ING", ":", " ", "DEBU", "G", " ", "MODE", " ", "ON", " ", "***", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fname", "\\u", "input_", "=_", "param_", "._", "path", "\\u", "dictionary_", "+_", "\"/", "err", "sm", "\\u", "34.", "ni", "i", ".", "gz", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fname", "\\u", "input_", "=_", "param_", "._", "path", "\\u", "dictionary_", "+_", "\"/", "err", "sm", "\\u", "3", "4", "\\u", "seg", "\\u", "in", ".", "ni", "i", ".", "gz", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "param", "\\u", "default_", "=_", "Param_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Initializ", "e", " ", "the", " ", "parser_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "=_", "Parser_", "(_", "\\u\\u", "file\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "usage_", "._", "set\\u", "description_", "(_", "'", "Project", " ", "all", " ", "the", " ", "input", " ", "image", " ", "slice", "s", " ", "on", " ", "a", " ", "PCA", " ", "generat", "ed", " ", "from", " ", "set", " ", "of", " ", "t2", "star", " ", "images", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "name_", "=_", "\"-", "i", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type", "\\u", "value_", "=_", "\"", "file", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "\"", "T2", "star", " ", "image", " ", "you", " ", "want", " ", "to", " ", "project", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mandatory_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "example_", "=_", "'", "t2", "star", ".", "ni", "i", ".", "gz", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "name_", "=_", "\"-", "dic", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type", "\\u", "value_", "=_", "\"", "folder", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "\"", "Path", " ", "to", " ", "the", " ", "dictionar", "y", " ", "of", " ", "images", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mandatory_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "example_", "=_", "'/", "home", "/", "jd", "oe", "/", "data", "/", "dictionar", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "name_", "=_", "\"-", "model", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type", "\\u", "value_", "=_", "\"", "multiple", "\\u", "choice", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "\"", "Load", " ", "or", " ", "compute", " ", "the", " ", "model", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mandatory_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "example_", "=_", "[_", "'", "load", "'_", ",_", "'", "compute", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "name_", "=_", "\"-", "l", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type", "\\u", "value_", "=_", "\"", "str", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "\"", "Image", " ", "contain", "ing", " ", "level", " ", "labels", " ", "for", " ", "the", " ", "target", " ", "or", " ", "str", " ", "indicati", "ng", " ", "the", " ", "level", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mandatory_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "example_", "=_", "'", "MN", "I", "-", "Poly", "-", "AM", "U", "\\u", "level", "\\u", "IR", "P", ".", "ni", "i", ".", "gz", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "name_", "=_", "\"-", "reg", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type", "\\u", "value_", "=_", "[_", "[_", "','_", "]_", ",_", "'", "str", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "\"", "list", " ", "of", " ", "transformation", "s", " ", "to", " ", "appl", "y", " ", "to", " ", "co", "-", "register", " ", "the", " ", "dictionar", "y", " ", "data", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mandatory_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default", "\\u", "value_", "=_", "[_", "'", "Affi", "ne", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "example_", "=_", "[_", "'", "Sy", "N", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "name_", "=_", "\"-", "target", "-", "reg", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type", "\\u", "value_", "=_", "'", "multiple", "\\u", "choice", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "\"", "type", " ", "of", " ", "registration", " ", "of", " ", "the", " ", "target", " ", "to", " ", "the", " ", "model", " ", "space", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"(", "if", " ", "pairwise", ",", " ", "the", " ", "registration", " ", "applied", " ", "to", " ", "the", " ", "target", " ", "are", " ", "the", " ", "same", " ", "as", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "tho", "se", " ", "of", " ", "the", " ", "-", "reg", " ", "flag", ")\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mandatory_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default", "\\u", "value_", "=_", "'", "pairwise", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "example_", "=_", "[_", "'", "pairwise", "'_", ",_", "'", "group", "wis", "e", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "name_", "=_", "\"-", "seg", "-", "type", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type", "\\u", "value_", "=_", "'", "multiple", "\\u", "choice", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "\"", "type", " ", "of", " ", "segmentation", " ", "(", "gray", " ", "matte", "r", " ", "or", " ", "white", " ", "matte", "r", ")\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mandatory_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default", "\\u", "value_", "=_", "'", "wm", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "example_", "=_", "[_", "'", "wm", "'_", ",_", "'", "gm", "'_", ",_", "'", "gm", "-", "model", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "name_", "=_", "\"-", "v", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type", "\\u", "value_", "=_", "\"", "int", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "\"", "verbo", "se", ":", " ", "0", " ", "=", " ", "not", "hing", ",", " ", "1", " ", "=", " ", "classic", ",", " ", "2", " ", "=", " ", "expen", "ded", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mandatory_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default", "\\u", "value_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "example_", "=_", "'", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "arguments_", "=_", "parser_", "._", "parse_", "(_", "sys_", "._", "argv_", "[_", "1_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input", "\\u", "target", "\\u", "fname_", "=_", "arguments_", "[_", "\"-", "i", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "param_", "._", "path", "\\u", "dictionary_", "=_", "arguments_", "[_", "\"-", "dic", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "param_", "._", "todo", "\\u", "model_", "=_", "arguments_", "[_", "\"-", "model", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\"-", "reg", "\"_", "in_", "arguments_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "param_", "._", "reg_", "=_", "arguments_", "[_", "\"-", "reg", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\"-", "target", "-", "reg", "\"_", "in_", "arguments_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "param_", "._", "target", "\\u", "reg_", "=_", "arguments_", "[_", "\"-", "target", "-", "reg", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\"-", "seg", "-", "type", "\"_", "in_", "arguments_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "param_", "._", "seg", "\\u", "type_", "=_", "arguments_", "[_", "\"-", "seg", "-", "type", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\"-", "l", "\"_", "in_", "arguments_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "param_", "._", "level", "\\u", "fname_", "=_", "arguments_", "[_", "\"-", "l", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\"-", "v", "\"_", "in_", "arguments_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "param_", "._", "verbose_", "=_", "arguments_", "[_", "\"-", "v", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "gm", "\\u", "seg", "\\u", "method_", "=_", "GM", "seg", "Supervis", "ed", "Method_", "(_", "input", "\\u", "target", "\\u", "fname_", ",_", "gm", "\\u", "seg", "\\u", "param_", "=_", "param_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "param_", "._", "verbose_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gm", "\\u", "seg", "\\u", "method_", "._", "show_", "(_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Param_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Param_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "debug_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "path", "\\u", "dictionary_", "=_", "None_", "#", " ", "'/", "Volume", "s", "/", "folder", "\\u", "shared", "/", "grey", "matte", "rse", "gment", "ation", "/", "data\\u", "asm", "an", "/", "dictionar", "y", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "todo", "\\u", "model_", "=_", "None_", "#", " ", "'", "compute", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "reg_", "=_", "None_", "#", " ", "TOD", "O", " ", ":", " ", "REMOVE", " ", "THA", "T", " ", "PARAM", " ", "WHE", "N", " ", "REGI", "STRAT", "ION", " ", "IS", " ", "OPTI", "MI", "ZED", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "target", "\\u", "reg_", "=_", "None_", "#", " ", "TOD", "O", " ", ":", " ", "REMOVE", " ", "THA", "T", " ", "PARAM", " ", "WHE", "N", " ", "GROU", "PW", "ISE", "/", "PAIR", " ", "IS", " ", "OPTI", "MI", "ZED", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "level", "\\u", "fname_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "seg", "\\u", "type_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "verbose_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Model", "Dictionary_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Dict", "ionar", "y", " ", "used", " ", "by", " ", "the", " ", "supervis", "ed", " ", "gray", " ", "matte", "r", " ", "segmentation", " ", "method", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\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_", "#", " ", "FUNCTIONS", " ", "USED", " ", "TO", " ", "COMPUTE", " ", "THE", " ", "MODEL_", "\\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\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "'''", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "nb", "\\u", "w", "\\u", "pixel", "s", "(", "self", "):", "\\", "10", ";", " ", " ", " ", " ", "s", "\\u", "w", "\\u", "pix", " ", "=", " ", "0", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "slice", " ", "in", " ", "self", ".", "slice", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "s", "\\u", "w", "\\u", "pix", " ", "+=", " ", "np", ".", "sum", "(", "slice", ".", "seg", ")", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "s", "\\u", "w", "\\u", "pix", "/", "self", ".", "J", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "'''", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "compute", "\\u", "major", "it", "y", "\\u", "vote", "\\u", "mean", "\\u", "seg", "\\u", "old", "\\u", "version", "(", "self", ",", " ", "seg", "\\u", "data\\u", "set", "):", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Compute", " ", "the", " ", "mean", " ", "segmentation", " ", "image", " ", "for", " ", "a", " ", "give", "n", " ", "segmentation", " ", "data", " ", "set", " ", "seg", "\\u", "data\\u", "set", " ", "by", " ", "Maj", "ori", "ty", " ", "Vote", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "seg", "\\u", "data\\u", "set", ":", "\\", "10", ";", " ", " ", " ", " ", ":", "return", ":", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "mean", "\\u", "seg", " ", "=", " ", "[]", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "dictionar", "y", " ", "contain", "ing", " ", "for", " ", "each", " ", "possib", "le", " ", "label", " ", "value", " ", ":", "\\", "10", ";", " ", " ", " ", " ", "#", " ", " ", "the", " ", "sum", " ", "of", " ", "all", " ", "the", " ", "flat", "ten", " ", "segmentation", " ", "in", " ", "seg", "\\u", "data\\u", "set", " ", "=", " ", "vector", " ", "of", " ", "the", " ", "sum", " ", "for", " ", "each", " ", "pixel", "\\", "10", ";", " ", " ", " ", " ", "choose", "\\u", "maj", "\\u", "vote", " ", "=", " ", "{}", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "for", " ", "0", " ", "and", " ", "for", " ", "1", " ", ":", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "l", " ", "in", " ", "self", ".", "L", ":", "\\", "10", ";", " ", " ", " ", " ", "to", "\\u", "be", "\\u", "summed", " ", "=", " ", "[]", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "dic", "\\u", "slice", " ", "in", " ", "seg", "\\u", "data\\u", "set", ":", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "vector", " ", "of", " ", "the", " ", "pixel", " ", "correspond", "ing", " ", "to", " ", "the", " ", "label", " ", "value", " ", "l", " ", "in", " ", "this", " ", "slice", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "0", " ", "if", " ", "the", " ", "pixel", " ", "is", " ", "different", " ", "than", " ", "the", " ", "label", " ", "value", ",", " ", "1", " ", "if", " ", "it", "'", "s", " ", "the", " ", "same", "\\", "10", ";", " ", " ", " ", " ", "consistent", "\\u", "vox", " ", "=", " ", "[]", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "row", " ", "in", " ", "dic", "\\u", "slice", ":", "\\", "10", ";", " ", " ", "for", " ", "i", " ", "in", " ", "row", ":", "\\", "10", ";", " ", " ", "try", ":", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "if", " ", "i", " ", ">", " ", "0.", "2", ":", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "i", " ", "=", " ", "1", "\\", "10", ";", " ", " ", "except", " ", "Value", "Error", ":", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "print", " ", "'", "Value", " ", "Error", " ", "with", " ", "i", " ", "=", " ", "',", " ", "i", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "print", " ", "'", "Datas", "et", " ", "was", " ", ":", " ", "\\\\", "n", "',", " ", "seg", "\\u", "data\\u", "set", "\\", "10", ";", " ", " ", "consistent", "\\u", "vox", ".", "append", "(", "kron", "eck", "er", "\\u", "delta", "(", "i", ",", " ", "l", "))\\", "10", ";", " ", " ", " ", " ", "to", "\\u", "be", "\\u", "summed", ".", "append", "(", "consistent", "\\u", "vox", ")", "\\", "10", ";", " ", " ", " ", " ", "summed", "\\u", "vector", " ", "=", " ", "np", ".", "zero", "s", "(", "len", "(", "to", "\\u", "be", "\\u", "summed", "[", "0", "])", ",", " ", "dt", "ype", "=", "np", ".", "int", ")", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "addin", "g", " ", "all", " ", "the", " ", "vector", "s", " ", "of", " ", "consistent", "\\u", "vox", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "v", " ", "in", " ", "to", "\\u", "be", "\\u", "summed", ":", "\\", "10", ";", " ", " ", " ", " ", "summed", "\\u", "vector", " ", "=", " ", "np", ".", "add", "(", "summed", "\\u", "vector", ",", " ", "v", ")", "\\", "10", ";", " ", " ", " ", " ", "choose", "\\u", "maj", "\\u", "vote", "[", "l", "]", " ", "=", " ", "summed", "\\u", "vector", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "for", " ", "each", " ", "pixel", " ", ":", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "the", " ", "value", " ", "chosen", " ", "for", " ", "mean", "\\u", "seg", " ", "is", " ", "the", " ", "value", " ", "tha", "t", " ", "was", " ", "the", " ", "most", " ", "presen", "t", " ", "in", " ", "the", " ", "data", " ", "set", " ", "for", " ", "this", " ", "pixel", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "vote", "\\u", "tuple", " ", "in", " ", "zip", "(", "choose", "\\u", "maj", "\\u", "vote", "[", "0", "],", " ", "choose", "\\u", "maj", "\\u", "vote", "[", "1", "])", ":", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "vote", "\\u", "tuple", "[", "0", "]", " ", ">=", " ", "vote", "\\u", "tuple", "[", "1", "]:", "\\", "10", ";", " ", " ", " ", " ", "mean", "\\u", "seg", ".", "append", "(", "0", ")", "\\", "10", ";", " ", " ", " ", " ", "eli", "f", " ", "vote", "\\u", "tuple", "[", "1", "]", " ", ">", " ", "vote", "\\u", "tuple", "[", "0", "]:", "\\", "10", ";", " ", " ", " ", " ", "mean", "\\u", "seg", ".", "append", "(", "1", ")", "\\", "10", ";", " ", " ", " ", " ", "n", " ", "=", " ", "int", "(", "sqrt", "(", "self", ".", "N", "))\\", "10", ";", " ", " ", " ", " ", "return", " ", "np", ".", "asa", "rray", "(", "mean", "\\u", "seg", ").", "reshape", "(", "n", ",", " ", "n", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "'''", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "crop", "\\u", "data\\u", "new", "\\u", "ellips", "e", "(", "self", "):", "\\", "10", ";", " ", " ", " ", " ", "#", "crop", "ing", " ", "the", " ", "im", "\\u", "M", " ", "images", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", "mean", "\\u", "seg", " ", "dimension", "s", " ", ":", "\\", "10", ";", " ", " ", " ", " ", "#", "height", "\\", "10", ";", " ", " ", " ", " ", "down", " ", "=", " ", "Tru", "e", "\\", "10", ";", " ", " ", " ", " ", "above", " ", "=", " ", "Fal", "se", "\\", "10", ";", " ", " ", " ", " ", "height", "\\u", "min", " ", "=", " ", "0", "\\", "10", ";", " ", " ", " ", " ", "height", "\\u", "max", " ", "=", " ", "0", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "h", ",", "row", " ", "in", " ", "enumerate", "(", "self", ".", "mean", "\\u", "seg", ".", "T", "):", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "sum", "(", "row", ")", " ", "==", " ", "0", ":", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "down", " ", ":", "\\", "10", ";", " ", " ", "height", "\\u", "min", " ", "=", " ", "h", "\\", "10", ";", " ", " ", " ", " ", "eli", "f", " ", "not", " ", "above", ":", "\\", "10", ";", " ", " ", "height", "\\u", "max", " ", "=", " ", "h", "\\", "10", ";", " ", " ", "above", " ", "=", " ", "Tru", "e", "\\", "10", ";", " ", " ", " ", " ", "else", ":", "\\", "10", ";", " ", " ", " ", " ", "down", " ", "=", " ", "Fal", "se", "\\", "10", ";", " ", " ", " ", " ", "height", "\\u", "min", " ", "+=", " ", "1", "\\", "10", ";", " ", " ", " ", " ", "height", "\\u", "max", " ", "-=", " ", "1", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", "widt", "h", "\\", "10", ";", " ", " ", " ", " ", "left", " ", "=", " ", "Tru", "e", "\\", "10", ";", " ", " ", " ", " ", "right", " ", "=", " ", "Fal", "se", "\\", "10", ";", " ", " ", " ", " ", "widt", "h", "\\u", "min", " ", "=", " ", "0", "\\", "10", ";", " ", " ", " ", " ", "widt", "h", "\\u", "max", " ", "=", " ", "0", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "w", ",", "row", " ", "in", " ", "enumerate", "(", "self", ".", "mean", "\\u", "seg", "):", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "sum", "(", "row", ")", " ", "==", " ", "0", ":", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "left", " ", ":", "\\", "10", ";", " ", " ", "widt", "h", "\\u", "min", " ", "=", " ", "w", "\\", "10", ";", " ", " ", " ", " ", "eli", "f", " ", "not", " ", "right", ":", "\\", "10", ";", " ", " ", "widt", "h", "\\u", "max", " ", "=", " ", "w", "\\", "10", ";", " ", " ", "right", " ", "=", " ", "Tru", "e", "\\", "10", ";", " ", " ", " ", " ", "else", ":", "\\", "10", ";", " ", " ", " ", " ", "left", " ", "=", " ", "Fal", "se", "\\", "10", ";", " ", " ", " ", " ", "widt", "h", "\\u", "min", " ", "+=", " ", "1", "\\", "10", ";", " ", " ", " ", " ", "widt", "h", "\\u", "max", " ", "-=", " ", "1", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "=", " ", "(", "widt", "h", "\\u", "max", " ", "-", " ", "widt", "h", "\\u", "min", ")/", "2.0", "\\", "10", ";", " ", " ", " ", " ", "b", " ", "=", " ", "(", "height", "\\u", "max", " ", "-", " ", "height", "\\u", "min", ")/", "2.0", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "range", "\\u", "x", " ", "=", " ", "np", ".", "asa", "rray", "(", "range", "(", "int", "(-", "10", "*", "a", "),", "int", "(", "10", "*", "a", ")+", "1", "))", " ", "/", "10.", "0", "\\", "10", ";", " ", " ", " ", " ", "top", "\\u", "points", " ", "=", " ", "[(", "b", " ", "*", " ", "sqrt", "(", "1", "-(", "x", "**", "2", "/", "a", "**", "2", "))", ",", "x", ")", " ", "for", " ", "x", " ", "in", " ", "range", "\\u", "x", "]", "\\", "10", ";", " ", " ", " ", " ", "n", " ", "=", " ", "int", "(", "sqrt", "(", "self", ".", "N", "))\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "top", "\\u", "points", ".", "sort", "()", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "ellips", "e\\u", "mask", " ", "=", " ", "np", ".", "zero", "s", "((", "n", ",", "n", "))\\", "10", ";", " ", " ", " ", " ", "don", "e\\u", "rows", " ", "=", " ", "[]", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "point", " ", "in", " ", "top", "\\u", "points", ":", "\\", "10", ";", " ", " ", " ", " ", "y", "\\u", "plus", " ", "=", " ", "int", "(", "round", "((", "n", "/", "2", ")+", "point", "[", "0", "]))", "\\", "10", ";", " ", " ", " ", " ", "y", "\\u", "minu", "s", " ", "=", " ", "int", "(", "round", "((", "n", "/", "2", ")-", "point", "[", "0", "]))", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "'", "y", "\\u", "plus", "',", " ", "y", "\\u", "plus", ",", " ", "'", "y", "\\u", "minu", "s", "',", " ", "y", "\\u", "minu", "s", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "y", "\\u", "plus", " ", "not", " ", "in", " ", "don", "e\\u", "rows", ":", "\\", "10", ";", " ", " ", " ", " ", "x", "\\u", "plus", " ", "=", " ", "int", "(", "round", "((", "n", "/", "2", ")+", "abs", "(", "point", "[", "1", "]))", ")", "\\", "10", ";", " ", " ", " ", " ", "x", "\\u", "minu", "s", " ", "=", " ", "int", "(", "round", "((", "n", "/", "2", ")-", "abs", "(", "point", "[", "1", "]))", ")", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "x", " ", "in", " ", "range", "(", "x", "\\u", "minu", "s", ",", " ", "x", "\\u", "plus", "+", "1", "):", "\\", "10", ";", " ", " ", "ellips", "e\\u", "mask", "[", "x", ",", " ", "y", "\\u", "plus", "]", " ", "=", " ", "1", "\\", "10", ";", " ", " ", "ellips", "e\\u", "mask", "[", "x", ",", " ", "y", "\\u", "minu", "s", "]", " ", "=", " ", "1", "\\", "10", ";", " ", " ", " ", " ", "don", "e\\u", "rows", ".", "append", "(", "y", "\\u", "plus", ")", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "'", "axis", "',", " ", "a", ",", " ", "b", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "'", "don", "e\\u", "rows", "',", " ", "don", "e\\u", "rows", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "'", "center", " ", ":", " ", "',", " ", "int", "(", "n", "/", "2", ")", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "ellips", "e\\u", "mask", "\\", "10", ";", " ", " ", " ", " ", "save", "\\u", "image", "(", "ellips", "e\\u", "mask", ",", " ", "'", "ellips", "e\\u", "mask", "',", " ", "path", "=", "self", ".", "model", "\\u", "dic", "\\u", "name", "+'", "/'", ",", " ", "type", "='", "uint", "8", "')", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "crop", "\\u", "data", "(", "self", "):", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Cro", "p", " ", "the", " ", "model", " ", "images", " ", "(", "im", "\\u", "M", ")", " ", "to", " ", "an", " ", "ellips", "e", " ", "shape", " ", "to", " ", "get", " ", "rid", " ", "of", " ", "the", " ", "size", "/", "shape", " ", "variab", "ilit", "y", " ", "bet", "ween", " ", "slice", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "im", "\\u", "mean", "\\u", "seg", " ", "=", " ", "Image", "(", "param", "=", "self", ".", "mean", "\\u", "seg", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "nz", "\\u", "coord", " ", "=", " ", "im", "\\u", "mean", "\\u", "seg", ".", "get", "Non", "Zero", "Coordinat", "es", "()", "\\", "10", ";", " ", " ", " ", " ", "nz", "\\u", "coord", "\\u", "dic", " ", "=", " ", "{}", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "coord", " ", "in", " ", "nz", "\\u", "coord", ":", "\\", "10", ";", " ", " ", " ", " ", "nz", "\\u", "coord", "\\u", "dic", "[", "coord", ".", "x", "]", " ", "=", " ", "[]", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "coord", " ", "in", " ", "nz", "\\u", "coord", ":", "\\", "10", ";", " ", " ", " ", " ", "nz", "\\u", "coord", "\\u", "dic", "[", "coord", ".", "x", "].", "append", "(", "coord", ".", "y", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "ellips", "e\\u", "mask", " ", "=", " ", "im", "\\u", "mean", "\\u", "seg", ".", "copy", "()", ".", "data", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "x", ",", " ", "y", "\\u", "list", " ", "in", " ", "nz", "\\u", "coord", "\\u", "dic", ".", "items", "():", "\\", "10", ";", " ", " ", " ", " ", "full", "\\u", "y", "\\u", "list", " ", "=", " ", "range", "(", "min", "(", "y", "\\u", "list", "),", " ", "max", "(", "y", "\\u", "list", ")+", "1", ")", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "y", "\\u", "list", " ", "!=", " ", "full", "\\u", "y", "\\u", "list", ":", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "y", " ", "in", " ", "full", "\\u", "y", "\\u", "list", ":", "\\", "10", ";", " ", " ", "ellips", "e\\u", "mask", "[", "x", ",", " ", "y", "]", " ", "=", " ", "1", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "save", "\\u", "image", "(", "ellips", "e\\u", "mask", ",", " ", "'", "ellips", "e\\u", "mask", "',", " ", "path", "=", "self", ".", "model", "\\u", "dic", "\\u", "name", "+'", "/'", ",", " ", "im", "\\u", "type", "='", "uint", "8", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "dic", "\\u", "slice", " ", "in", " ", "self", ".", "slice", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "new", "\\u", "im", "\\u", "m", " ", "=", " ", "np", ".", "ein", "sum", "('", "ij", ",", "ij", "->", "ij", "',", " ", "ellips", "e\\u", "mask", ",", " ", "dic", "\\u", "slice", ".", "im", "\\u", "M", ")", "\\", "10", ";", " ", " ", " ", " ", "dic", "\\u", "slice", ".", "set", "(", "im", "\\u", "m", "=", "new", "\\u", "im", "\\u", "m", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "END", " ", "OF", " ", "FUNCTIONS", " ", "USED", " ", "TO", " ", "COMPUTE", " ", "THE", " ", "MODEL_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "ADA", "PT", " ", "LOAD", " ", "DI", "C", " ", "TO", " ", "GM", "\\u", "SEG", " ", "AND", " ", "WM", "\\u", "SEG", " ", "ATTRIBUTE", "S", " ", "FOR", " ", "THE", " ", "SLI", "CES", "_", "\\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_", "Model", "Dictionary_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "dic", "\\u", "param_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "model", " ", "dictionar", "y", " ", "construct", "or", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "dic", "\\u", "param", ":", " ", "dictionar", "y", " ", "parameter", "s", ",", " ", "type", ":", " ", "Param", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dic", "\\u", "param_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "param_", "=_", "Param_", "(_", ")_", "\\u\\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_", "._", "param_", "=_", "dic", "\\u", "param_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "list", " ", "of", " ", "the", " ", "slice", "s", " ", "of", " ", "the", " ", "dictionary_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "slices_", "=_", "[_", "]_", "#", " ", "type", ":", " ", "list", " ", "of", " ", "slices_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "number", " ", "of", " ", "slices_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "J_", "=_", "0_", "#", " ", "type", ":", " ", "int_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "dimension", " ", "of", " ", "the", " ", "slice", "s", " ", "(", "flattened", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "N_", "=_", "0_", "#", " ", "type", ":", " ", "int_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "mean", " ", "segmentation", " ", "image", " ", "of", " ", "the", " ", "dictionary_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mean", "\\u", "seg_", "=_", "None_", "#", " ", "type", ":", " ", "nump", "y", " ", "array_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "mean", " ", "image", " ", "of", " ", "the", " ", "dictionary_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mean", "\\u", "image_", "=_", "None_", "#", " ", "type", ":", " ", "nump", "y", " ", "array_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dictionar", "y", " ", "contain", "ing", " ", "informati", "on", " ", "abo", "ut", " ", "the", " ", "data", " ", "dictionar", "y", " ", "slice", "s", " ", "by", " ", "subject", " ", ":", " ", "used", " ", "to", " ", "save", " ", "the", " ", "model", " ", "only_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", ".", "dic", "\\u", "data\\u", "info", "[", "subject", "]", " ", "=", " ", "{", "'", "n", "\\u", "slice", "s", "':", " ", "0", ",", " ", "'", "inverted", "\\u", "gm", "\\u", "seg", "':", " ", "[]", ",", " ", "'", "im", "\\u", "M", "':", " ", "[]", ",", " ", "'", "seg", "\\u", "M", "':", " ", "[]", "}_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "dic", "\\u", "data\\u", "info_", "=_", "{_", "}_", "#", " ", "type", ":", " ", "dictionary_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "list", " ", "of", " ", "transformation", " ", "to", " ", "appl", "y", " ", "to", " ", "each", " ", "slice", " ", "to", " ", "co", "-", "register", " ", "the", " ", "data", " ", "int", "o", " ", "the", " ", "common", " ", "group", "wis", "e", " ", "space_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "param_", "._", "reg_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "core", "gist", "ration", "\\u", "transf", "os_", "=_", "self_", "._", "param_", "._", "reg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "core", "gist", "ration", "\\u", "transf", "os_", "=_", "[_", "'", "Affi", "ne", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "suffix_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "transf", "o_", "in_", "self_", "._", "core", "gist", "ration", "\\u", "transf", "os_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "suffix_", "+=_", "'\\u'_", "+_", "transf", "o_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "self", ".", "core", "gist", "ration", "\\u", "transf", "os", " ", "=", " ", "['", "Sy", "N", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "folder", " ", "contain", "ing", " ", "the", " ", "saved", " ", "model_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "model", "\\u", "dic", "\\u", "name_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "param_", "._", "todo", "\\u", "model_", "==_", "'", "compute", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "model", "\\u", "dic", "\\u", "name_", "=_", "'./", "gm", "seg", "\\u", "model", "\\u", "dictionar", "y", "'_", "+_", "suffix_", "#", " ", "TOD", "O", ":", " ", "remove", " ", "suffix_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "compute", "\\u", "model", "\\u", "dictionary_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "param_", "._", "todo", "\\u", "model_", "==_", "'", "load", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "model", "\\u", "dic", "\\u", "name_", "=_", "self_", "._", "param_", "._", "path", "\\u", "dictionary_", "#", " ", "TOD", "O", " ", "change", " ", "the", " ", "path", " ", "by", " ", "the", " ", "name", " ", "of", " ", "the", " ", "dic", " ", "??", " ", "..._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "load", "\\u", "model", "\\u", "dictionary_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sct", "_", "._", "print", "v_", "(_", "'", "WARN", "ING", ":", " ", "no", " ", "todo", "\\u", "model", " ", "param", "'_", ",_", "self_", "._", "param_", "._", "verbose_", ",_", "'", "warn", "ing", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "save", " ", "all", " ", "the", " ", "dictionar", "y", " ", "slices_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "-->", " ", "not", " ", "used", " ", "by", " ", "the", " ", "model", ",", " ", "only", " ", "for", " ", "visualization", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "'''", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "'", "data\\u", "by", "\\u", "slice", "'", " ", "not", " ", "in", " ", "os", ".", "listd", "ir", "('.", "')", ":", "\\", "10", ";", " ", " ", " ", " ", "sct", ".", "run", "('", "mkd", "ir", " ", "./", "data\\u", "by", "\\u", "slice", "')", "\\", "10", ";", " ", " ", " ", " ", "os", ".", "chd", "ir", "('.", "/", "data\\u", "by", "\\u", "slice", "')", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "j", " ", "in", " ", "range", "(", "self", ".", "J", "):", "\\", "10", ";", " ", " ", " ", " ", "save", "\\u", "image", "(", "self", ".", "slice", "s", "[", "j", "].", "im", ",", " ", "'", "slice", "\\u", "'+", "str", "(", "j", ")", " ", "+", " ", "'\\u", "im", "')", "\\", "10", ";", " ", " ", " ", " ", "save", "\\u", "image", "(", "self", ".", "slice", "s", "[", "j", "].", "im", "\\u", "M", ",", " ", "'", "slice", "\\u", "'+", "str", "(", "j", ")", " ", "+", " ", "'\\u", "register", "ed", "\\u", "im", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "save", "\\u", "image", "(", "self", ".", "slice", "s", "[", "j", "].", "seg", ",", " ", "'", "slice", "\\u", "'+", "str", "(", "j", ")", " ", "+", " ", "'\\u", "seg", "')", "\\", "10", ";", " ", " ", " ", " ", "save", "\\u", "image", "(", "self", ".", "slice", "s", "[", "j", "].", "seg", "\\u", "M", ",", " ", "'", "slice", "\\u", "'+", "str", "(", "j", ")", " ", "+", " ", "'\\u", "register", "ed", "\\u", "seg", "')", "\\", "10", ";", " ", " ", " ", " ", "os", ".", "chd", "ir", "('.", ".'", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "self", ".", "param", ".", "verbo", "se", " ", "==", " ", "2", ":", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "show", "\\u", "data", "()", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Dictionary_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compute", "\\u", "model", "\\u", "dictionary_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Compute", " ", "the", " ", "model", " ", "dictionar", "y", " ", "usi", "ng", " ", "the", " ", "provided", " ", "data", " ", "set", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Comp", "uti", "ng", " ", "the", " ", "model", " ", "dictionar", "y", " ", "...'_", ",_", "self_", "._", "param_", "._", "verbose_", ",_", "'", "normal", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Load", " ", "all", " ", "the", " ", "images", "'", " ", "slice", "s", " ", "from", " ", "param", ".", "path", "\\u", "dictionary_", "\\u\\u\\uNL\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Load", "ing", " ", "data", " ", "dictionar", "y", " ", "...'_", ",_", "self_", "._", "param_", "._", "verbose_", ",_", "'", "normal", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "List", " ", "of", " ", "T2", "star", " ", "images", " ", "(", "im", ")", " ", "and", " ", "thei", "r", " ", "label", " ", "decision", " ", "(", "seg", ")", " ", "(", "=", "segmentation", " ", "of", " ", "the", " ", "gray", " ", "matte", "r", "),", " ", "slice", " ", "by", " ", "slice_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sct", "_", "._", "run_", "(_", "'", "mkd", "ir", " ", "'_", "+_", "self_", "._", "model", "\\u", "dic", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "slices_", "=_", "self_", "._", "load", "\\u", "data\\u", "dictionary_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "number", " ", "of", " ", "slice", "s", " ", "in", " ", "the", " ", "data", " ", "set_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "J_", "=_", "len_", "(_", "[_", "dic", "\\u", "slice_", "._", "im_", "for_", "dic", "\\u", "slice_", "in_", "self_", "._", "slices_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "dimension", " ", "of", " ", "the", " ", "data", " ", "(", "flat", "ten", " ", "slice", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "N_", "=_", "len_", "(_", "self_", "._", "slices_", "[_", "0_", "]_", "._", "im_", "._", "flatten_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "save", "\\u", "model", "\\u", "data_", "(_", "'", "im", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "param_", "._", "seg", "\\u", "type_", "!=_", "'", "gm", "-", "model", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "invert", "s", " ", "the", " ", "segmentation", " ", "slice", "s", " ", ":", " ", "the", " ", "model", " ", "use", "s", " ", "segmentation", " ", "of", " ", "the", " ", "WM", " ", "inst", "ead", " ", "of", " ", "segmentation", " ", "of", " ", "the", " ", "GM", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "invert", "\\u", "seg_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "save", "\\u", "model", "\\u", "data_", "(_", "'", "inverted", "\\u", "gm", "\\u", "seg", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Comp", "uti", "ng", " ", "the", " ", "transformation", " ", "to", " ", "co", "-", "register", " ", "all", " ", "the", " ", "data", " ", "int", "o", " ", "a", " ", "common", " ", "group", "wis", "e", " ", "space", " ", "...'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "param_", "._", "verbose_", ",_", "'", "normal", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mean", "\\u", "seg_", "=_", "self_", "._", "seg", "\\u", "core", "gist", "ration", "_", "(_", "transf", "o", "\\u", "to", "\\u", "apply_", "=_", "self_", "._", "core", "gist", "ration", "\\u", "transf", "os_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "save", "\\u", "model", "\\u", "data_", "(_", "'", "seg", "\\u", "M", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Co", "-", "register", "ing", " ", "all", " ", "the", " ", "data", " ", "int", "o", " ", "the", " ", "common", " ", "group", "wis", "e", " ", "space", " ", "...'_", ",_", "self_", "._", "param_", "._", "verbose_", ",_", "'", "normal", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "List", " ", "of", " ", "images", " ", "(", "im", "\\u", "M", ")", " ", "and", " ", "thei", "r", " ", "label", " ", "decision", " ", "(", "seg", "\\u", "M", ")", " ", "(", "=", "segmentation", " ", "of", " ", "the", " ", "gray", " ", "matte", "r", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "-->", " ", "slice", " ", "by", " ", "slice", " ", "in", " ", "the", " ", "common", " ", "group", "wis", "e", " ", "space_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "core", "gister", "\\u", "data_", "(_", "transf", "o", "\\u", "to", "\\u", "apply_", "=_", "self_", "._", "core", "gist", "ration", "\\u", "transf", "os_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", " ", " ", " ", " ", "TESTING", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "crop", "\\u", "data", "()", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "save", "\\u", "model", "\\u", "data_", "(_", "'", "im", "\\u", "M", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mean", "\\u", "image_", "=_", "self_", "._", "compute", "\\u", "mean", "\\u", "dic", "\\u", "image_", "(_", "np_", "._", "asarray_", "(_", "[_", "dic", "\\u", "slice_", "._", "im", "\\u", "M_", "for_", "dic", "\\u", "slice_", "in_", "self_", "._", "slices_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "save", "\\u", "image_", "(_", "self_", "._", "mean", "\\u", "image_", ",_", "'", "mean", "\\u", "image", "'_", ",_", "path_", "=_", "self_", "._", "model", "\\u", "dic", "\\u", "name_", "+_", "'/'_", ",_", "im", "\\u", "type_", "=_", "'", "uint", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Dictionary_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load", "\\u", "data\\u", "dictionary_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "each", " ", "slice", " ", "of", " ", "each", " ", "subject", " ", "will", " ", "be", " ", "load", "ed", " ", "separately", " ", "in", " ", "a", " ", "Slice", " ", "object", " ", "contain", "ing", " ", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "a", " ", "slice", " ", "id", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "the", " ", "original", " ", "T2", "star", " ", "image", " ", "crop", " ", "aro", "und", " ", "the", " ", "spin", "al", " ", "cord", ":", " ", "im", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "a", " ", "manu", "al", " ", "segmentation", " ", "of", " ", "the", " ", "gray", " ", "matte", "r", ":", " ", "seg", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", " ", "slice", "s", ":", " ", "nump", "y", " ", "array", " ", "of", " ", "all", " ", "the", " ", "slice", "s", " ", "of", " ", "the", " ", "data", " ", "dictionar", "y", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "initialization", "_", "\\u\\u\\uNL\\u\\u\\u_", "slices_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "change", " ", "the", " ", "name", " ", "of", " ", "files", " ", "to", " ", "find", " ", "to", " ", "a", " ", "more", " ", "genera", "l", " ", "structure_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "subject", "\\u", "dir_", "in_", "os_", "._", "listdir_", "(_", "self_", "._", "param_", "._", "path", "\\u", "dictionary_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subject", "\\u", "path_", "=_", "self_", "._", "param_", "._", "path", "\\u", "dictionary_", "+_", "'/'_", "+_", "subject", "\\u", "dir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "subject", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "dic", "\\u", "data\\u", "info_", "[_", "subject", "\\u", "dir_", "]_", "=_", "{_", "'", "n", "\\u", "slice", "s", "'_", ":_", "0_", ",_", "'", "inverted", "\\u", "gm", "\\u", "seg", "'_", ":_", "[_", "]_", ",_", "'", "im", "\\u", "M", "'_", ":_", "[_", "]_", ",_", "'", "seg", "\\u", "M", "'_", ":_", "[_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "subject", "\\u", "seg", "\\u", "in_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subject", "\\u", "gm", "\\u", "seg_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "run_", "(_", "'", "mkd", "ir", " ", "'_", "+_", "self_", "._", "model", "\\u", "dic", "\\u", "name_", "+_", "'/'_", "+_", "subject", "\\u", "dir_", ",_", "verbose_", "=_", "self_", "._", "param_", "._", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "file", "\\u", "name_", "in_", "os_", "._", "listdir_", "(_", "subject", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "'", "GM", "'_", "in_", "file", "\\u", "name_", "or_", "'", "gm", "seg", "'_", "in_", "file", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "subject", "\\u", "gm", "\\u", "seg_", "=_", "file", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "'''", "\\", "10", ";", " ", " ", "#", " ", "copy", " ", "of", " ", "the", " ", "seg", " ", "image", " ", "in", " ", "the", " ", "saved", " ", "model", " ", "folder", "\\", "10", ";", " ", " ", "sct", ".", "run", "('", "cp", " ", "./", "'", " ", "+", " ", "self", ".", "param", ".", "path", "\\u", "dictionar", "y", " ", "+", " ", "subject", "\\u", "dir", " ", "+", " ", "'/'", " ", "+", " ", "file", "\\u", "name", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "+", " ", "'", " ", "'", " ", "+", " ", "self", ".", "model", "\\u", "dic", "\\u", "name", " ", "+", " ", "'/'", " ", "+", " ", "subject", "\\u", "dir", " ", "+", " ", "'/'", " ", "+", " ", "subject", "\\u", "dir", " ", "+", " ", "'\\u", "seg", ".", "ni", "i", ".", "gz", "')", "\\", "10", ";", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "seg", "\\u", "in", "'_", "in_", "file", "\\u", "name_", "and_", "'", "gm", "'_", "not_", "in_", "file", "\\u", "name_", "._", "lower_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "subject", "\\u", "seg", "\\u", "in_", "=_", "file", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "'''", "\\", "10", ";", " ", " ", "#", " ", "copy", " ", "of", " ", "the", " ", "slice", " ", "image", " ", "in", " ", "the", " ", "saved", " ", "model", " ", "folder", "\\", "10", ";", " ", " ", "sct", ".", "run", "('", "cp", " ", "./", "'", " ", "+", " ", "self", ".", "param", ".", "path", "\\u", "dictionar", "y", " ", "+", " ", "subject", "\\u", "dir", " ", "+", " ", "'/'", " ", "+", " ", "file", "\\u", "name", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "+", " ", "'", " ", "'", " ", "+", " ", "self", ".", "model", "\\u", "dic", "\\u", "name", " ", "+", " ", "'/'", " ", "+", " ", "subject", "\\u", "dir", " ", "+", " ", "'/'", " ", "+", " ", "subject", "\\u", "dir", " ", "+", " ", "'\\u", "im", ".", "ni", "i", ".", "gz", "')", "\\", "10", ";", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "im_", "=_", "Image_", "(_", "subject", "\\u", "path_", "+_", "'/'_", "+_", "subject", "\\u", "seg", "\\u", "in_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seg_", "=_", "Image_", "(_", "subject", "\\u", "path_", "+_", "'/'_", "+_", "subject", "\\u", "gm", "\\u", "seg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "im", "\\u", "slice_", ",_", "seg", "\\u", "slice_", "in_", "zip_", "(_", "im_", "._", "data_", ",_", "seg_", "._", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "dic", "\\u", "data\\u", "info_", "[_", "subject", "\\u", "dir_", "]_", "[_", "'", "n", "\\u", "slice", "s", "'_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slices_", "._", "append_", "(_", "Slice_", "(_", "slice", "\\u", "id_", "=_", "j_", ",_", "im_", "=_", "im", "\\u", "slice_", ",_", "gm", "\\u", "seg_", "=_", "seg", "\\u", "slice_", ",_", "reg", "\\u", "to", "\\u", "m_", "=_", "[_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j_", "+=_", "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_", "return_", "np_", "._", "asarray_", "(_", "slices_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Dictionary_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save", "\\u", "model", "\\u", "data_", "(_", "self_", ",_", "what", "\\u", "to", "\\u", "save_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "save", " ", "3", "D", " ", "images", " ", "of", " ", "the", " ", "model", " ", "dictionar", "y", " ", "usi", "ng", " ", "the", " ", "dictionar", "y", " ", "of", " ", "informati", "on", " ", "abo", "ut", " ", "the", " ", "data", " ", "slice", "s", " ", "by", " ", "subject", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "what", "\\u", "to", "\\u", "save", ":", " ", "type", " ", "of", " ", "data", " ", "to", " ", "be", " ", "saved", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suffix_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "to", "\\u", "save_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total", "\\u", "n", "\\u", "slices_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "what", "\\u", "to", "\\u", "save_", "==_", "'", "gm", "\\u", "seg", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "suffix_", "=_", "'\\u", "gm", "\\u", "seg", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "to", "\\u", "save_", "=_", "[_", "dic", "\\u", "slice_", "._", "gm", "\\u", "seg_", "for_", "dic", "\\u", "slice_", "in_", "self_", "._", "slices_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "what", "\\u", "to", "\\u", "save_", "==_", "'", "inverted", "\\u", "gm", "\\u", "seg", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "suffix_", "=_", "'\\u", "wm", "\\u", "seg", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "to", "\\u", "save_", "=_", "[_", "dic", "\\u", "slice_", "._", "wm", "\\u", "seg_", "for_", "dic", "\\u", "slice_", "in_", "self_", "._", "slices_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "what", "\\u", "to", "\\u", "save_", "==_", "'", "im", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "suffix_", "=_", "'\\u", "im", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "to", "\\u", "save_", "=_", "[_", "dic", "\\u", "slice_", "._", "im_", "for_", "dic", "\\u", "slice_", "in_", "self_", "._", "slices_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "what", "\\u", "to", "\\u", "save_", "==_", "'", "im", "\\u", "M", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "suffix_", "=_", "'\\u", "im", "\\u", "model", "\\u", "space", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "to", "\\u", "save_", "=_", "[_", "dic", "\\u", "slice_", "._", "im", "\\u", "M_", "for_", "dic", "\\u", "slice_", "in_", "self_", "._", "slices_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "what", "\\u", "to", "\\u", "save_", "==_", "'", "gm", "\\u", "seg", "\\u", "M", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "suffix_", "=_", "'\\u", "gm", "\\u", "seg", "\\u", "model", "\\u", "space", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "to", "\\u", "save_", "=_", "[_", "dic", "\\u", "slice_", "._", "gm", "\\u", "seg", "\\u", "M_", "for_", "dic", "\\u", "slice_", "in_", "self_", "._", "slices_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "what", "\\u", "to", "\\u", "save_", "==_", "'", "wm", "\\u", "seg", "\\u", "M", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "suffix_", "=_", "'\\u", "wm", "\\u", "seg", "\\u", "model", "\\u", "space", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "to", "\\u", "save_", "=_", "[_", "dic", "\\u", "slice_", "._", "wm", "\\u", "seg", "\\u", "M_", "for_", "dic", "\\u", "slice_", "in_", "self_", "._", "slices_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "subject", "\\u", "name_", "in_", "sorted_", "(_", "self_", "._", "dic", "\\u", "data\\u", "info_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "first", "\\u", "subject", "\\u", "slice_", "=_", "total", "\\u", "n", "\\u", "slices_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "\\u", "subject", "\\u", "slice_", "=_", "first", "\\u", "subject", "\\u", "slice_", "+_", "self_", "._", "dic", "\\u", "data\\u", "info_", "[_", "subject", "\\u", "name_", "]_", "[_", "'", "n", "\\u", "slice", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dic", "\\u", "data\\u", "info_", "[_", "subject", "\\u", "name_", "]_", "[_", "what", "\\u", "to", "\\u", "save_", "]_", "=_", "data\\u", "to", "\\u", "save_", "[_", "first", "\\u", "subject", "\\u", "slice_", ":_", "last", "\\u", "subject", "\\u", "slice_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total", "\\u", "n", "\\u", "slices_", "+=_", "self_", "._", "dic", "\\u", "data\\u", "info_", "[_", "subject", "\\u", "name_", "]_", "[_", "'", "n", "\\u", "slice", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "subject", "\\u", "name_", ",_", "info_", "in_", "zip_", "(_", "self_", "._", "dic", "\\u", "data\\u", "info_", "._", "keys_", "(_", ")_", ",_", "self_", "._", "dic", "\\u", "data\\u", "info_", "._", "values_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", ",_", "slice", "\\u", "i_", "in_", "enumerate_", "(_", "info_", "[_", "what", "\\u", "to", "\\u", "save_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "to", "\\u", "save_", "=_", "Image_", "(_", "param_", "=_", "np_", "._", "asarray_", "(_", "slice", "\\u", "i_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "save_", "._", "path_", "=_", "self_", "._", "model", "\\u", "dic", "\\u", "name_", "+_", "'/'_", "+_", "subject", "\\u", "name_", "+_", "'/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "to", "\\u", "save_", "._", "file", "\\u", "name_", "=_", "subject", "\\u", "name_", "+_", "'\\u", "slice", "'_", "+_", "str_", "(_", "i_", ")_", "+_", "suffix_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "save_", "._", "ext_", "=_", "'.", "ni", "i", ".", "gz", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "save_", "._", "save_", "(_", "type_", "=_", "'", "minimize", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Dictionary_", ":_", "\\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_", "invert", "\\u", "seg_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Invert", " ", "the", " ", "gray", " ", "matte", "r", " ", "segmentation", " ", "to", " ", "get", " ", "segmentation", " ", "of", " ", "the", " ", "white", " ", "matte", "r", " ", "inst", "ead", "\\", "10", ";", " ", " ", " ", " ", "keep", "s", " ", "more", " ", "informati", "on", ",", " ", "theore", "tica", "ll", "y", " ", "bett", "er", " ", "results", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "dic", "\\u", "slice_", "in_", "self_", "._", "slices_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "im", "\\u", "dic_", "=_", "Image_", "(_", "param_", "=_", "dic", "\\u", "slice_", "._", "im_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sc_", "=_", "im", "\\u", "dic_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nz", "\\u", "coord", "\\u", "sc_", "=_", "sc_", "._", "get", "Non", "Zero", "Coordinates_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "\\u", "seg_", "=_", "Image_", "(_", "param_", "=_", "dic", "\\u", "slice_", "._", "gm", "\\u", "seg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nz", "\\u", "coord", "\\u", "d_", "=_", "im", "\\u", "seg_", "._", "get", "Non", "Zero", "Coordinates_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "coord_", "in_", "nz", "\\u", "coord", "\\u", "sc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sc_", "._", "data_", "[_", "coord_", "._", "x_", ",_", "coord_", "._", "y_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "coord_", "in_", "nz", "\\u", "coord", "\\u", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "im", "\\u", "seg_", "._", "data_", "[_", "coord_", "._", "x_", ",_", "coord_", "._", "y_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "cast", " ", "of", " ", "the", " ", "-1", " ", "values", " ", "(-", ">", " ", "GM", " ", "pixel", " ", "at", " ", "the", " ", "exteri", "or", " ", "of", " ", "the", " ", "SC", " ", "pixel", "s", ")", " ", "to", " ", "+", "1", " ", "-->", " ", "WM", " ", "pixel_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "inverted", "\\u", "slice", "\\u", "seg_", "=_", "np_", "._", "absolute_", "(_", "sc_", "._", "data_", "-_", "im", "\\u", "seg_", "._", "data_", ")_", "._", "astype_", "(_", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dic", "\\u", "slice_", "._", "set_", "(_", "wm", "\\u", "seg_", "=_", "inverted", "\\u", "slice", "\\u", "seg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Dictionary_", ":_", "\\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_", "seg", "\\u", "core", "gist", "ration", "_", "(_", "self_", ",_", "transf", "o", "\\u", "to", "\\u", "apply_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "all", " ", "the", " ", "segmentation", " ", "slice", "s", ",", " ", "do", " ", "a", " ", "registration", " ", "of", " ", "the", " ", "segmentation", " ", "slice", " ", "to", " ", "the", " ", "mean", " ", "segmentation", "\\", "10", ";", " ", " ", " ", " ", " ", "appl", "ying", " ", "all", " ", "the", " ", "transformation", "s", " ", "in", " ", "transf", "o", "\\u", "to", "\\u", "appl", "y", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Compute", ",", " ", "appl", "y", " ", "and", " ", "save", " ", "each", " ", "transformation", " ", "warp", "ing", " ", "field", " ", "for", " ", "all", " ", "the", " ", "segmentation", " ", "slice", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Compute", " ", "the", " ", "new", " ", "mean", " ", "segmentation", " ", "at", " ", "each", " ", "step", " ", "and", " ", "update", " ", "self", ".", "mean", "\\u", "seg", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "transf", "o", "\\u", "to", "\\u", "appl", "y", ":", " ", "list", " ", "of", " ", "string", "\\", "10", ";", " ", " ", " ", " ", ":", "return", ":", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "param_", "._", "seg", "\\u", "type_", "==_", "'", "gm", "-", "model", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "current", "\\u", "mean", "\\u", "seg_", "=_", "compute", "\\u", "major", "it", "y", "\\u", "vote", "\\u", "mean", "\\u", "seg_", "(_", "np_", "._", "asarray_", "(_", "[_", "dic", "\\u", "slice_", "._", "gm", "\\u", "seg_", "for_", "dic", "\\u", "slice_", "in_", "self_", "._", "slices_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "current", "\\u", "mean", "\\u", "seg_", "=_", "compute", "\\u", "major", "it", "y", "\\u", "vote", "\\u", "mean", "\\u", "seg_", "(_", "np_", "._", "asarray_", "(_", "[_", "dic", "\\u", "slice_", "._", "wm", "\\u", "seg_", "for_", "dic", "\\u", "slice_", "in_", "self_", "._", "slices_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "transf", "o_", "in_", "transf", "o", "\\u", "to", "\\u", "apply_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sct", "_", "._", "print", "v_", "(_", "'", "Do", "ing", " ", "a", " ", "'_", "+_", "transf", "o_", "+_", "'", " ", "registration", " ", "of", " ", "each", " ", "segmentation", " ", "slice", " ", "to", " ", "the", " ", "mean", " ", "segmentation", " ", "...'_", ",_", "self_", "._", "param_", "._", "verbose_", ",_", "'", "normal", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "mean", "\\u", "seg_", "=_", "self_", "._", "find", "\\u", "core", "gist", "ration", "_", "(_", "mean", "\\u", "seg_", "=_", "current", "\\u", "mean", "\\u", "seg_", ",_", "transf", "o", "\\u", "type_", "=_", "transf", "o_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "'''", "\\", "10", ";", " ", " ", " ", " ", "fig", "=", "plt", ".", "figure", "()", "\\", "10", ";", " ", " ", " ", " ", "plt", ".", "ims", "how", "(", "current", "\\u", "mean", "\\u", "seg", ")", "\\", "10", ";", " ", " ", " ", " ", "plt", ".", "title", "('", "Curr", "ent", " ", "mean", " ", "segmentation", " ", "...", "')", "\\", "10", ";", " ", " ", " ", " ", "plt", ".", "plot", "()", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "fig", "=", "plt", ".", "figure", "()", "\\", "10", ";", " ", " ", " ", " ", "plt", ".", "ims", "how", "(", "self", ".", "slice", "s", "[", "0", "].", "seg", "\\u", "M", ")", "\\", "10", ";", " ", " ", " ", " ", "plt", ".", "title", "('", "slice", " ", "0.", "..", "')", "\\", "10", ";", " ", " ", " ", " ", "plt", ".", "plot", "()", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "mean", " ", "number", " ", "of", " ", "white", " ", "pixel", "s", " ", "in", " ", "the", " ", "manu", "al", " ", "segmentation", " ", "slice", "s", " ", "of", " ", "the", " ", "dictionar", "y", "\\", "10", ";", " ", " ", " ", " ", "mean", "\\u", "white", "\\u", "pix", " ", "=", " ", "self", ".", "nb", "\\u", "w", "\\u", "pixel", "s", "()", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "mean", "\\u", "white", "\\u", "pix", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "i", "=", "1", "\\", "10", ";", " ", " ", " ", " ", "whi", "le", " ", "np", ".", "sum", "(", "current", "\\u", "mean", "\\u", "seg", ")", " ", "<", " ", "0.", "8", "*", "mean", "\\u", "white", "\\u", "pix", ":", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "'--", ">", " ", "Affi", "ne", " ", "registration", " ", "number", " ", "',", "i", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "'", "number", " ", "of", " ", "white", " ", "pixel", "s", " ", "in", " ", "the", " ", "current", " ", "mean", " ", "seg", "',", " ", "np", ".", "sum", "(", "current", "\\u", "mean", "\\u", "seg", ")", "\\", "10", ";", " ", " ", " ", " ", "current", "\\u", "mean", "\\u", "seg", " ", "=", " ", "self", ".", "compute", "\\u", "mean", "\\u", "seg", "(", "np", ".", "asa", "rray", "([", "slice", ".", "seg", "\\u", "M", " ", "for", " ", "slice", " ", "in", " ", "self", ".", "slice", "s", "]))", "\\", "10", ";", " ", " ", " ", " ", "current", "\\u", "mean", "\\u", "seg", " ", "=", " ", "self", ".", "find", "\\u", "core", "gist", "ration", "(", "mean", "\\u", "seg", "=", "current", "\\u", "mean", "\\u", "seg", ",", " ", "transf", "o", "\\u", "type", "='", "Affi", "ne", "')", "\\", "10", ";", " ", " ", " ", " ", "i", "+=", "10", "\\", "10", ";", " ", " ", " ", " ", "#", "current", "\\u", "mean", "\\u", "seg", " ", "=", " ", "self", ".", "compute", "\\u", "mean", "\\u", "seg", "(", "np", ".", "asa", "rray", "([", "slice", ".", "seg", "\\u", "M", " ", "for", " ", "slice", " ", "in", " ", "self", ".", "slice", "s", "]))", "\\", "10", ";", " ", " ", " ", " ", "current", "\\u", "mean", "\\u", "seg", " ", "=", " ", "self", ".", "find", "\\u", "core", "gist", "ration", "(", "mean", "\\u", "seg", "=", "current", "\\u", "mean", "\\u", "seg", ",", " ", "transf", "o", "\\u", "type", "='", "Affi", "ne", "')", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result", "ing", "\\u", "mean", "\\u", "seg_", "=_", "current", "\\u", "mean", "\\u", "seg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "result", "ing", "\\u", "mean", "\\u", "seg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Dictionary_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "find", "\\u", "core", "gist", "ration", "_", "(_", "self_", ",_", "mean", "\\u", "seg_", "=_", "None_", ",_", "transf", "o", "\\u", "type_", "=_", "'", "Rig", "id", "'_", ",_", "first_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "each", " ", "segmentation", " ", "slice", ",", " ", "appl", "y", " ", "and", " ", "save", " ", "a", " ", "registration", " ", "of", " ", "the", " ", "specified", " ", "type", " ", "of", " ", "transformation", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "name", " ", "of", " ", "the", " ", "registration", " ", "file", " ", "(", "usual", "ly", " ", "a", " ", "matlab", " ", "matrix", ")", " ", "is", " ", "saved", " ", "in", " ", "self", ".", "Rt", "o", "M", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "mean", "\\u", "seg", ":", " ", "current", " ", "mean", " ", "segmentation", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "transf", "o", "\\u", "type", ":", " ", "type", " ", "of", " ", "transformation", " ", "for", " ", "the", " ", "registration", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", " ", "mean", " ", "seg", ":", " ", "update", "d", " ", "mean", " ", "segmentation", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "dic", "\\u", "slice_", "in_", "self_", "._", "slices_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name", "\\u", "j", "\\u", "transform_", "=_", "'", "transform", "\\u", "slice", "\\u'_", "+_", "str_", "(_", "dic", "\\u", "slice_", "._", "id_", ")_", "+_", "find", "\\u", "ant", "s", "\\u", "transf", "o", "\\u", "name_", "(_", "transf", "o", "\\u", "type_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "reg", "\\u", "list_", "=_", "dic", "\\u", "slice_", "._", "reg", "\\u", "to", "\\u", "M_", "._", "append_", "(_", "name", "\\u", "j", "\\u", "transform_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dic", "\\u", "slice_", "._", "set_", "(_", "reg", "\\u", "to", "\\u", "m_", "=_", "new", "\\u", "reg", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "first_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "param_", "._", "seg", "\\u", "type_", "==_", "'", "gm", "-", "model", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "seg", "\\u", "m_", "=_", "appl", "y", "\\u", "ant", "s", "\\u", "transf", "o_", "(_", "mean", "\\u", "seg_", ",_", "dic", "\\u", "slice_", "._", "gm", "\\u", "seg_", ",_", "transf", "o", "\\u", "name_", "=_", "name", "\\u", "j", "\\u", "transform_", ",_", "path_", "=_", "self_", "._", "model", "\\u", "dic", "\\u", "name_", "+_", "'/'_", ",_", "transf", "o", "\\u", "type_", "=_", "transf", "o", "\\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 ", " ", "_", "seg", "\\u", "m_", "=_", "appl", "y", "\\u", "ant", "s", "\\u", "transf", "o_", "(_", "mean", "\\u", "seg_", ",_", "dic", "\\u", "slice_", "._", "wm", "\\u", "seg_", ",_", "transf", "o", "\\u", "name_", "=_", "name", "\\u", "j", "\\u", "transform_", ",_", "path_", "=_", "self_", "._", "model", "\\u", "dic", "\\u", "name_", "+_", "'/'_", ",_", "transf", "o", "\\u", "type_", "=_", "transf", "o", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "param_", "._", "seg", "\\u", "type_", "==_", "'", "gm", "-", "model", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "seg", "\\u", "m_", "=_", "appl", "y", "\\u", "ant", "s", "\\u", "transf", "o_", "(_", "mean", "\\u", "seg_", ",_", "dic", "\\u", "slice_", "._", "gm", "\\u", "seg", "\\u", "M_", ",_", "transf", "o", "\\u", "name_", "=_", "name", "\\u", "j", "\\u", "transform_", ",_", "path_", "=_", "self_", "._", "model", "\\u", "dic", "\\u", "name_", "+_", "'/'_", ",_", "transf", "o", "\\u", "type_", "=_", "transf", "o", "\\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 ", " ", "_", "seg", "\\u", "m_", "=_", "appl", "y", "\\u", "ant", "s", "\\u", "transf", "o_", "(_", "mean", "\\u", "seg_", ",_", "dic", "\\u", "slice_", "._", "wm", "\\u", "seg", "\\u", "M_", ",_", "transf", "o", "\\u", "name_", "=_", "name", "\\u", "j", "\\u", "transform_", ",_", "path_", "=_", "self_", "._", "model", "\\u", "dic", "\\u", "name_", "+_", "'/'_", ",_", "transf", "o", "\\u", "type_", "=_", "transf", "o", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "param_", "._", "seg", "\\u", "type_", "==_", "'", "gm", "-", "model", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dic", "\\u", "slice_", "._", "set_", "(_", "gm", "\\u", "seg", "\\u", "m_", "=_", "seg", "\\u", "m_", "._", "astype_", "(_", "int_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dic", "\\u", "slice_", "._", "set_", "(_", "gm", "\\u", "seg", "\\u", "m", "\\u", "flat_", "=_", "seg", "\\u", "m_", "._", "flatten_", "(_", ")_", "._", "astype_", "(_", "int_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dic", "\\u", "slice_", "._", "set_", "(_", "wm", "\\u", "seg", "\\u", "m_", "=_", "seg", "\\u", "m_", "._", "astype_", "(_", "int_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dic", "\\u", "slice_", "._", "set_", "(_", "wm", "\\u", "seg", "\\u", "m", "\\u", "flat_", "=_", "seg", "\\u", "m_", "._", "flatten_", "(_", ")_", "._", "astype_", "(_", "int_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "param_", "._", "seg", "\\u", "type_", "==_", "'", "gm", "-", "model", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mean", "\\u", "seg_", "=_", "compute", "\\u", "major", "it", "y", "\\u", "vote", "\\u", "mean", "\\u", "seg_", "(_", "[_", "dic", "\\u", "slice_", "._", "gm", "\\u", "seg", "\\u", "M_", "for_", "dic", "\\u", "slice_", "in_", "self_", "._", "slices_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mean", "\\u", "seg_", "=_", "compute", "\\u", "major", "it", "y", "\\u", "vote", "\\u", "mean", "\\u", "seg_", "(_", "[_", "dic", "\\u", "slice_", "._", "wm", "\\u", "seg", "\\u", "M_", "for_", "dic", "\\u", "slice_", "in_", "self_", "._", "slices_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "save", "\\u", "image_", "(_", "mean", "\\u", "seg_", ",_", "'", "mean", "\\u", "seg", "'_", ",_", "path_", "=_", "self_", "._", "model", "\\u", "dic", "\\u", "name_", "+_", "'/'_", ",_", "im", "\\u", "type_", "=_", "'", "uint", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "mean", "\\u", "seg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Dictionary_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "compute", "\\u", "mean", "\\u", "dic", "\\u", "image_", "(_", "self_", ",_", "im", "\\u", "data\\u", "set_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Compute", " ", "the", " ", "mean", " ", "image", " ", "of", " ", "the", " ", "dictionar", "y", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Us", "ed", " ", "to", " ", "co", "-", "register", " ", "the", " ", "dictionar", "y", " ", "images", " ", "int", "o", " ", "te", "h", " ", "common", " ", "group", "wis", "e", " ", "space", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "im", "\\u", "data\\u", "set", ":", "\\", "10", ";", " ", " ", " ", " ", ":", "return", " ", "mean", ":", " ", "mean", " ", "image", " ", "of", " ", "the", " ", "input", " ", "data", " ", "set", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mean_", "=_", "np_", "._", "sum_", "(_", "im", "\\u", "data\\u", "set_", ",_", "axis_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mean_", "/=_", "float_", "(_", "self_", "._", "J_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "mean_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Dictionary_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "core", "gister", "\\u", "data_", "(_", "self_", ",_", "transf", "o", "\\u", "to", "\\u", "apply_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Apply", " ", "to", " ", "each", " ", "image", " ", "slice", " ", "of", " ", "the", " ", "dictionar", "y", " ", "the", " ", "transformation", "s", " ", "found", " ", "register", "ing", " ", "the", " ", "segmentation", " ", "slice", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "co", "\\u", "register", "ed", " ", "images", " ", "are", " ", "saved", " ", "for", " ", "each", " ", "slice", " ", "as", " ", "im", "\\u", "M", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "transf", "o", "\\u", "to", "\\u", "appl", "y", ":", " ", "list", " ", "of", " ", "string", "\\", "10", ";", " ", " ", " ", " ", ":", "return", ":", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "im_", "=_", "[_", "dic", "\\u", "slice_", "._", "im_", "for_", "dic", "\\u", "slice_", "in_", "self_", "._", "slices_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "gm", "\\u", "seg_", "=_", "[_", "dic", "\\u", "slice_", "._", "gm", "\\u", "seg_", "for_", "dic", "\\u", "slice_", "in_", "self_", "._", "slices_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "dic", "\\u", "slice_", "in_", "self_", "._", "slices_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "n", "\\u", "transf", "o_", ",_", "transf", "o_", "in_", "enumerate_", "(_", "transf", "o", "\\u", "to", "\\u", "apply_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "im", "\\u", "m_", "=_", "appl", "y", "\\u", "ant", "s", "\\u", "transf", "o_", "(_", "self_", "._", "compute", "\\u", "mean", "\\u", "dic", "\\u", "image_", "(_", "list", "\\u", "im_", ")_", ",_", "dic", "\\u", "slice_", "._", "im_", ",_", "search", "\\u", "reg_", "=_", "False_", ",_", "transf", "o", "\\u", "name_", "=_", "dic", "\\u", "slice_", "._", "reg", "\\u", "to", "\\u", "M_", "[_", "n", "\\u", "transf", "o_", "]_", ",_", "binary_", "=_", "False_", ",_", "path_", "=_", "self_", "._", "model", "\\u", "dic", "\\u", "name_", "+_", "'/'_", ",_", "transf", "o", "\\u", "type_", "=_", "transf", "o_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "appl", "y", "\\u", "2", "D", "\\u", "rigid", "\\u", "transformation", "(", "self", ".", "im", "[", "j", "],", " ", "self", ".", "RM", "[", "j", "]['", "tx", "']", ",", " ", "self", ".", "RM", "[", "j", "]['", "ty", "']", ",", " ", "self", ".", "RM", "[", "j", "]['", "theta", "'])", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "param_", "._", "seg", "\\u", "type_", "==_", "'", "gm", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "gm", "\\u", "seg", "\\u", "m_", "=_", "appl", "y", "\\u", "ant", "s", "\\u", "transf", "o_", "(_", "self_", "._", "compute", "\\u", "mean", "\\u", "dic", "\\u", "image_", "(_", "list", "\\u", "gm", "\\u", "seg_", ")_", ",_", "dic", "\\u", "slice_", "._", "gm", "\\u", "seg_", ",_", "search", "\\u", "reg_", "=_", "False_", ",_", "transf", "o", "\\u", "name_", "=_", "dic", "\\u", "slice_", "._", "reg", "\\u", "to", "\\u", "M_", "[_", "n", "\\u", "transf", "o_", "]_", ",_", "binary_", "=_", "False_", ",_", "path_", "=_", "self_", "._", "model", "\\u", "dic", "\\u", "name_", "+_", "'/'_", ",_", "transf", "o", "\\u", "type_", "=_", "transf", "o_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dic", "\\u", "slice_", "._", "set_", "(_", "im", "\\u", "m_", "=_", "im", "\\u", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dic", "\\u", "slice_", "._", "set_", "(_", "im", "\\u", "m", "\\u", "flat_", "=_", "im", "\\u", "m_", "._", "flatten_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "param_", "._", "seg", "\\u", "type_", "==_", "'", "gm", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dic", "\\u", "slice_", "._", "set_", "(_", "gm", "\\u", "seg", "\\u", "m_", "=_", "gm", "\\u", "seg", "\\u", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dic", "\\u", "slice_", "._", "set_", "(_", "gm", "\\u", "seg", "\\u", "m", "\\u", "flat_", "=_", "gm", "\\u", "seg", "\\u", "m_", "._", "flatten_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Dictionary_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "load", "\\u", "model", "\\u", "dictionary_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Load", " ", "the", " ", "model", " ", "dictionar", "y", " ", "from", " ", "a", " ", "saved", " ", "one", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "itertools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Load", "ing", " ", "the", " ", "model", " ", "dictionar", "y", " ", "...'_", ",_", "self_", "._", "param_", "._", "verbose_", ",_", "'", "normal", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "j_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "subject", "\\u", "dir_", "in_", "os_", "._", "listdir_", "(_", "self_", "._", "model", "\\u", "dic", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subject", "\\u", "path_", "=_", "self_", "._", "model", "\\u", "dic", "\\u", "name_", "+_", "subject", "\\u", "dir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "subject", "\\u", "path_", ")_", "and_", "'", "transformation", "s", "'_", "not_", "in_", "subject", "\\u", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subject", "\\u", "im_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "\\u", "mat_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subject", "\\u", "seg_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seg", "\\u", "mat_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subject", "\\u", "im", "\\u", "m_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "\\u", "m_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subject", "\\u", "seg", "\\u", "m_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seg", "\\u", "m_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "file", "\\u", "name_", "in_", "os_", "._", "listdir_", "(_", "subject", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "'\\u", "im", ".", "ni", "i", "'_", "in_", "file", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "subject", "\\u", "im_", "=_", "file", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'\\u", "seg", ".", "ni", "i", "'_", "in_", "file", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "subject", "\\u", "seg_", "=_", "file", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'\\u", "im", "\\u", "model", "\\u", "space", ".", "ni", "i", "'_", "in_", "file", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "subject", "\\u", "im", "\\u", "m_", "=_", "file", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'\\u", "seg", "\\u", "model", "\\u", "space", ".", "ni", "i", "'_", "in_", "file", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "subject", "\\u", "seg", "\\u", "m_", "=_", "file", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "subject", "\\u", "im_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "im_", "=_", "Image_", "(_", "subject", "\\u", "path_", "+_", "'/'_", "+_", "subject", "\\u", "im_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "\\u", "mat_", "=_", "im_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "subject", "\\u", "seg_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "seg_", "=_", "Image_", "(_", "subject", "\\u", "path_", "+_", "'/'_", "+_", "subject", "\\u", "seg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seg", "\\u", "mat_", "=_", "seg_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "subject", "\\u", "im", "\\u", "m_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "im", "\\u", "m_", "=_", "Image_", "(_", "subject", "\\u", "path_", "+_", "'/'_", "+_", "subject", "\\u", "im", "\\u", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sct", "_", "._", "print", "v_", "(_", "'", "WARN", "ING", ":", " ", "no", " ", "dictionar", "y", " ", "image", " ", "in", " ", "model", " ", "space", " ", "for", " ", "'_", "+_", "subject", "\\u", "dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "param_", "._", "verbose_", ",_", "'", "warn", "ing", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "subject", "\\u", "seg", "\\u", "m_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "seg", "\\u", "m_", "=_", "Image_", "(_", "subject", "\\u", "path_", "+_", "'/'_", "+_", "subject", "\\u", "seg", "\\u", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sct", "_", "._", "print", "v_", "(_", "'", "WARN", "ING", ":", " ", "no", " ", "segmentation", " ", "in", " ", "model", " ", "space", " ", "for", " ", "'_", "+_", "subject", "\\u", "dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "param_", "._", "verbose_", ",_", "'", "warn", "ing", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "im", "\\u", "mat_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "im", "\\u", "mat_", "=_", "itertools_", "._", "repeat_", "(_", "None_", ",_", "im", "\\u", "m_", "._", "data_", "._", "shape_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "seg", "\\u", "mat_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "seg", "\\u", "mat_", "=_", "itertools_", "._", "repeat_", "(_", "None_", ",_", "im", "\\u", "m_", "._", "data_", "._", "shape_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "im", "\\u", "slice_", ",_", "seg", "\\u", "slice_", ",_", "im", "\\u", "m", "\\u", "slice_", ",_", "seg", "\\u", "m", "\\u", "slice_", "in_", "zip_", "(_", "im", "\\u", "mat_", ",_", "seg", "\\u", "mat_", ",_", "im", "\\u", "m_", "._", "data_", ",_", "seg", "\\u", "m_", "._", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "reg", "\\u", "list_", "=_", "[_", "'", "transform", "\\u", "slice", "\\u'_", "+_", "str_", "(_", "j_", ")_", "+_", "find", "\\u", "ant", "s", "\\u", "transf", "o", "\\u", "name_", "(_", "transf", "o", "\\u", "type_", ")_", "[_", "0_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "transf", "o", "\\u", "type_", "in_", "self_", "._", "core", "gist", "ration", "\\u", "transf", "os_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "slices_", "._", "append_", "(_", "Slice_", "(_", "slice", "\\u", "id_", "=_", "j_", ",_", "im_", "=_", "im", "\\u", "slice_", ",_", "seg_", "=_", "seg", "\\u", "slice_", ",_", "im", "\\u", "m_", "=_", "im", "\\u", "m", "\\u", "slice_", ",_", "seg", "\\u", "m_", "=_", "seg", "\\u", "m", "\\u", "slice_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "im", "\\u", "m", "\\u", "flat_", "=_", "im", "\\u", "m", "\\u", "slice_", "._", "flatten_", "(_", ")_", ",_", "seg", "\\u", "m", "\\u", "flat_", "=_", "seg", "\\u", "m", "\\u", "slice_", "._", "flatten_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reg", "\\u", "to", "\\u", "m_", "=_", "reg", "\\u", "list_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "number", " ", "of", " ", "atlas", "es", " ", "in", " ", "the", " ", "dictionary_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "J_", "=_", "len_", "(_", "self_", "._", "slices_", ")_", "#", " ", "len", "([", "slice", ".", "im", " ", "for", " ", "slice", " ", "in", " ", "self", ".", "slice", "s", "])", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dimension", " ", "of", " ", "the", " ", "data", " ", "(", "flat", "ten", " ", "slice", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "N_", "=_", "len_", "(_", "self_", "._", "slices_", "[_", "0_", "]_", "._", "im", "\\u", "M_", "._", "flatten_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mean", "\\u", "image_", "=_", "Image_", "(_", "self_", "._", "model", "\\u", "dic", "\\u", "name_", "+_", "'", "mean", "\\u", "image", ".", "ni", "i", ".", "gz", "'_", ")_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mean", "\\u", "seg_", "=_", "Image_", "(_", "self_", "._", "model", "\\u", "dic", "\\u", "name_", "+_", "'", "mean", "\\u", "seg", ".", "ni", "i", ".", "gz", "'_", ")_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Dictionary_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "show", "\\u", "data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "show", " ", "the", " ", "10", " ", "first", " ", "slice", "s", " ", "of", " ", "the", " ", "model", " ", "dictionar", "y", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "dic", "\\u", "slice_", "in_", "self_", "._", "slices_", "[_", ":_", "10_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fig_", "=_", "plt_", "._", "figure_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "seg", "\\u", "subplot_", "=_", "fig_", "._", "add", "\\u", "subplot_", "(_", "2_", ",_", "3_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seg", "\\u", "subplot_", "._", "set\\u", "title_", "(_", "'", "Origina", "l", " ", "space", " ", "-", " ", "seg", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "\\u", "seg_", "=_", "seg", "\\u", "subplot_", "._", "imshow_", "(_", "dic", "\\u", "slice_", "._", "wm", "\\u", "seg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "\\u", "seg_", "._", "set\\u", "interpolation_", "(_", "'", "near", "est", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "\\u", "seg_", "._", "set\\u", "cmap_", "(_", "'", "gray", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "seg", "\\u", "m", "\\u", "subplot_", "=_", "fig_", "._", "add", "\\u", "subplot_", "(_", "2_", ",_", "3_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seg", "\\u", "m", "\\u", "subplot_", "._", "set\\u", "title_", "(_", "'", "Common", " ", "group", "wis", "e", " ", "space", " ", "-", " ", "seg", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "\\u", "seg", "\\u", "m_", "=_", "seg", "\\u", "m", "\\u", "subplot_", "._", "imshow_", "(_", "dic", "\\u", "slice_", "._", "wm", "\\u", "seg", "\\u", "M_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "\\u", "seg", "\\u", "m_", "._", "set\\u", "interpolation_", "(_", "'", "near", "est", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "\\u", "seg", "\\u", "m_", "._", "set\\u", "cmap_", "(_", "'", "gray", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mean", "\\u", "seg", "\\u", "subplot_", "=_", "fig_", "._", "add", "\\u", "subplot_", "(_", "2_", ",_", "3_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mean", "\\u", "seg", "\\u", "subplot_", "._", "set\\u", "title_", "(_", "'", "Mea", "n", " ", "seg", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "\\u", "mean", "\\u", "seg_", "=_", "mean", "\\u", "seg", "\\u", "subplot_", "._", "imshow_", "(_", "np_", "._", "asarray_", "(_", "self_", "._", "mean", "\\u", "seg_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "\\u", "mean", "\\u", "seg_", "._", "set\\u", "interpolation_", "(_", "'", "near", "est", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "\\u", "mean", "\\u", "seg_", "._", "set\\u", "cmap_", "(_", "'", "gray", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "slice", "\\u", "im", "\\u", "subplot_", "=_", "fig_", "._", "add", "\\u", "subplot_", "(_", "2_", ",_", "3_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slice", "\\u", "im", "\\u", "subplot_", "._", "set\\u", "title_", "(_", "'", "Origina", "l", " ", "space", " ", "-", " ", "data", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "\\u", "slice", "\\u", "im_", "=_", "slice", "\\u", "im", "\\u", "subplot_", "._", "imshow_", "(_", "dic", "\\u", "slice_", "._", "im_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "\\u", "slice", "\\u", "im_", "._", "set\\u", "interpolation_", "(_", "'", "near", "est", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "\\u", "slice", "\\u", "im_", "._", "set\\u", "cmap_", "(_", "'", "gray", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "slice", "\\u", "im", "\\u", "m", "\\u", "subplot_", "=_", "fig_", "._", "add", "\\u", "subplot_", "(_", "2_", ",_", "3_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slice", "\\u", "im", "\\u", "m", "\\u", "subplot_", "._", "set\\u", "title_", "(_", "'", "Common", " ", "group", "wis", "e", " ", "space", " ", "-", " ", "data", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "\\u", "slice", "\\u", "im", "\\u", "m_", "=_", "slice", "\\u", "im", "\\u", "m", "\\u", "subplot_", "._", "imshow_", "(_", "dic", "\\u", "slice_", "._", "im", "\\u", "M_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "\\u", "slice", "\\u", "im", "\\u", "m_", "._", "set\\u", "interpolation_", "(_", "'", "near", "est", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "\\u", "slice", "\\u", "im", "\\u", "m_", "._", "set\\u", "cmap_", "(_", "'", "gray", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plt_", "._", "suptitle_", "(_", "'", "Slice", " ", "'_", "+_", "str_", "(_", "dic", "\\u", "slice_", "._", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "show_", "(_", ")_", "\\u\\u\\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_", "Model", "Dict", "ionar", "y", "By", "Slice_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Dict", "ionar", "y", " ", "used", " ", "by", " ", "the", " ", "supervis", "ed", " ", "gray", " ", "matte", "r", " ", "segmentation", " ", "method", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\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_", "#", " ", "FUNCTIONS", " ", "USED", " ", "TO", " ", "COMPUTE", " ", "THE", " ", "MODEL_", "\\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\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "END", " ", "OF", " ", "FUNCTIONS", " ", "USED", " ", "TO", " ", "COMPUTE", " ", "THE", " ", "MODEL_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "ADA", "PT", " ", "LOAD", " ", "MODEL", " ", "TO", " ", "GM", "SEG", " ", "AND", " ", "WM", "SEG", " ", "ATTRIBUTE", "S", " ", "OF", " ", "SLC", "IES_", "\\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_", "Model", "Dict", "ionar", "y", "By", "Slice_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "dic", "\\u", "param_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "model", " ", "dictionar", "y", " ", "construct", "or", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "dic", "\\u", "param", ":", " ", "dictionar", "y", " ", "parameter", "s", ",", " ", "type", ":", " ", "Param", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dic", "\\u", "param_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "param_", "=_", "Param_", "(_", ")_", "\\u\\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_", "._", "param_", "=_", "dic", "\\u", "param_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "level", "\\u", "label_", "=_", "{_", "0_", ":_", "''_", ",_", "1_", ":_", "'", "C1", "'_", ",_", "2_", ":_", "'", "C2", "'_", ",_", "3_", ":_", "'", "C3", "'_", ",_", "4_", ":_", "'", "C4", "'_", ",_", "5_", ":_", "'", "C5", "'_", ",_", "6_", ":_", "'", "C6", "'_", ",_", "7_", ":_", "'", "C", "7", "'_", ",_", "8_", ":_", "'", "T1", "'_", ",_", "9_", ":_", "'", "T2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "10_", ":_", "'", "T3", "'_", ",_", "11_", ":_", "'", "T", "4", "'_", ",_", "12_", ":_", "'", "T", "5", "'_", ",_", "13_", ":_", "'", "T6", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "list", " ", "of", " ", "the", " ", "slice", "s", " ", "of", " ", "the", " ", "dictionary_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "slices_", "=_", "[_", "]_", "#", " ", "type", ":", " ", "list", " ", "of", " ", "slices_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "number", " ", "of", " ", "slices_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "J_", "=_", "0_", "#", " ", "type", ":", " ", "int_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "dimension", " ", "of", " ", "the", " ", "slice", "s", " ", "(", "flattened", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "N_", "=_", "0_", "#", " ", "type", ":", " ", "int_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "mean", " ", "segmentation", " ", "image", " ", "of", " ", "the", " ", "dictionary_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mean", "\\u", "seg_", "=_", "None_", "#", " ", "type", ":", " ", "nump", "y", " ", "array_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "mean", " ", "image", " ", "of", " ", "the", " ", "dictionary_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mean", "\\u", "image_", "=_", "None_", "#", " ", "type", ":", " ", "nump", "y", " ", "array_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dictionar", "y", " ", "contain", "ing", " ", "informati", "on", " ", "abo", "ut", " ", "the", " ", "data", " ", "dictionar", "y", " ", "slice", "s", " ", "by", " ", "subject", " ", ":", " ", "used", " ", "to", " ", "save", " ", "the", " ", "model", " ", "only_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", ".", "dic", "\\u", "data\\u", "info", "[", "subject", "]", " ", "=", " ", "{", "'", "n", "\\u", "slice", "s", "':", " ", "0", ",", " ", "'", "inverted", "\\u", "gm", "\\u", "seg", "':", " ", "[]", ",", " ", "'", "im", "\\u", "M", "':", " ", "[]", ",", " ", "'", "seg", "\\u", "M", "':", " ", "[]", "}_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "dic", "\\u", "data\\u", "info_", "=_", "{_", "}_", "#", " ", "type", ":", " ", "dictionary_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "list", " ", "of", " ", "transformation", " ", "to", " ", "appl", "y", " ", "to", " ", "each", " ", "slice", " ", "to", " ", "co", "-", "register", " ", "the", " ", "data", " ", "int", "o", " ", "the", " ", "common", " ", "group", "wis", "e", " ", "space_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "param_", "._", "reg_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "core", "gist", "ration", "\\u", "transf", "os_", "=_", "self_", "._", "param_", "._", "reg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "core", "gist", "ration", "\\u", "transf", "os_", "=_", "[_", "'", "Affi", "ne", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "suffix_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "transf", "o_", "in_", "self_", "._", "core", "gist", "ration", "\\u", "transf", "os_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "suffix_", "+=_", "'\\u'_", "+_", "transf", "o_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "suffix_", "+=_", "'\\u'_", "+_", "self_", "._", "param_", "._", "seg", "\\u", "type_", "[_", "0_", ":_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "self", ".", "core", "gist", "ration", "\\u", "transf", "os", " ", "=", " ", "['", "Sy", "N", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "folder", " ", "contain", "ing", " ", "the", " ", "saved", " ", "model_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "model", "\\u", "dic", "\\u", "name_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "param_", "._", "todo", "\\u", "model_", "==_", "'", "compute", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "model", "\\u", "dic", "\\u", "name_", "=_", "'./", "gm", "seg", "\\u", "model", "\\u", "dictionar", "y", "'_", "+_", "suffix_", "#", " ", "TOD", "O", ":", " ", "remove", " ", "suff", "ix", " ", "whe", "n", " ", "reg", " ", "is", " ", "optimize", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "compute", "\\u", "model", "\\u", "dictionary_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "param_", "._", "todo", "\\u", "model_", "==_", "'", "load", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "model", "\\u", "dic", "\\u", "name_", "=_", "self_", "._", "param_", "._", "path", "\\u", "dictionary_", "#", " ", "TOD", "O", " ", "change", " ", "the", " ", "path", " ", "by", " ", "the", " ", "name", " ", "of", " ", "the", " ", "dic", " ", "??", " ", "..._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "load", "\\u", "model", "\\u", "dictionary_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sct", "_", "._", "print", "v_", "(_", "'", "WARN", "ING", ":", " ", "no", " ", "todo", "\\u", "model", " ", "param", "'_", ",_", "self_", "._", "param_", "._", "verbose_", ",_", "'", "warn", "ing", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Dict", "ionar", "y", "By", "Slice_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compute", "\\u", "model", "\\u", "dictionary_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Compute", " ", "the", " ", "model", " ", "dictionar", "y", " ", "usi", "ng", " ", "the", " ", "provided", " ", "data", " ", "set", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Comp", "uti", "ng", " ", "the", " ", "model", " ", "dictionar", "y", " ", "...'_", ",_", "self_", "._", "param_", "._", "verbose_", ",_", "'", "normal", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Load", " ", "all", " ", "the", " ", "images", "'", " ", "slice", "s", " ", "from", " ", "param", ".", "path", "\\u", "dictionary_", "\\u\\u\\uNL\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Load", "ing", " ", "data", " ", "dictionar", "y", " ", "...'_", ",_", "self_", "._", "param_", "._", "verbose_", ",_", "'", "normal", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "List", " ", "of", " ", "T2", "star", " ", "images", " ", "(", "im", ")", " ", "and", " ", "thei", "r", " ", "label", " ", "decision", " ", "(", "seg", ")", " ", "(", "=", "segmentation", " ", "of", " ", "the", " ", "gray", " ", "matte", "r", "),", " ", "slice", " ", "by", " ", "slice_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sct", "_", "._", "run_", "(_", "'", "mkd", "ir", " ", "'_", "+_", "self_", "._", "model", "\\u", "dic", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "slices_", "=_", "self_", "._", "load", "\\u", "data\\u", "dictionary_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "number", " ", "of", " ", "slice", "s", " ", "in", " ", "the", " ", "data", " ", "set_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "J_", "=_", "len_", "(_", "[_", "dic", "\\u", "slice_", "._", "im_", "for_", "dic", "\\u", "slice_", "in_", "self_", "._", "slices_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "dimension", " ", "of", " ", "the", " ", "data", " ", "(", "flat", "ten", " ", "slice", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "N_", "=_", "len_", "(_", "self_", "._", "slices_", "[_", "0_", "]_", "._", "im_", "._", "flatten_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "param_", "._", "seg", "\\u", "type_", "!=_", "'", "gm", "-", "model", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "invert", "s", " ", "the", " ", "segmentation", " ", "slice", "s", " ", ":", " ", "the", " ", "model", " ", "use", "s", " ", "segmentation", " ", "of", " ", "the", " ", "WM", " ", "inst", "ead", " ", "of", " ", "segmentation", " ", "of", " ", "the", " ", "GM", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "invert", "\\u", "seg_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "save", "\\u", "model", "\\u", "data_", "(_", "'", "inverted", "\\u", "gm", "\\u", "seg", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Comp", "uti", "ng", " ", "the", " ", "transformation", " ", "to", " ", "co", "-", "register", " ", "all", " ", "the", " ", "data", " ", "int", "o", " ", "a", " ", "common", " ", "group", "wis", "e", " ", "space", " ", "...'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "param_", "._", "verbose_", ",_", "'", "normal", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mean", "\\u", "seg_", "=_", "self_", "._", "seg", "\\u", "core", "gist", "ration", "_", "(_", "transf", "o", "\\u", "to", "\\u", "apply_", "=_", "self_", "._", "core", "gist", "ration", "\\u", "transf", "os_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "param_", "._", "seg", "\\u", "type_", "==_", "'", "gm", "-", "model", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "save", "\\u", "model", "\\u", "data_", "(_", "'", "gm", "\\u", "seg", "\\u", "M", "'_", ")_", "\\u\\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_", "._", "save", "\\u", "model", "\\u", "data_", "(_", "'", "wm", "\\u", "seg", "\\u", "M", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Co", "-", "register", "ing", " ", "all", " ", "the", " ", "data", " ", "int", "o", " ", "the", " ", "common", " ", "group", "wis", "e", " ", "space", " ", "...'_", ",_", "self_", "._", "param_", "._", "verbose_", ",_", "'", "normal", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "List", " ", "of", " ", "images", " ", "(", "im", "\\u", "M", ")", " ", "and", " ", "thei", "r", " ", "label", " ", "decision", " ", "(", "seg", "\\u", "M", ")", " ", "(", "=", "segmentation", " ", "of", " ", "the", " ", "gray", " ", "matte", "r", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "-->", " ", "slice", " ", "by", " ", "slice", " ", "in", " ", "the", " ", "common", " ", "group", "wis", "e", " ", "space_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "core", "gister", "\\u", "data_", "(_", "transf", "o", "\\u", "to", "\\u", "apply_", "=_", "self_", "._", "core", "gist", "ration", "\\u", "transf", "os_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "save", "\\u", "model", "\\u", "data_", "(_", "'", "im", "\\u", "M", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mean", "\\u", "image_", "=_", "self_", "._", "compute", "\\u", "mean", "\\u", "dic", "\\u", "image_", "(_", "np_", "._", "asarray_", "(_", "[_", "dic", "\\u", "slice_", "._", "im", "\\u", "M_", "for_", "dic", "\\u", "slice_", "in_", "self_", "._", "slices_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "save", "\\u", "image_", "(_", "self_", "._", "mean", "\\u", "image_", ",_", "'", "mean", "\\u", "image", "'_", ",_", "path_", "=_", "self_", "._", "model", "\\u", "dic", "\\u", "name_", "+_", "'/'_", ",_", "im", "\\u", "type_", "=_", "'", "uint", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Dict", "ionar", "y", "By", "Slice_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load", "\\u", "data\\u", "dictionary_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "each", " ", "slice", " ", "of", " ", "each", " ", "subject", " ", "will", " ", "be", " ", "load", "ed", " ", "separately", " ", "in", " ", "a", " ", "Slice", " ", "object", " ", "contain", "ing", " ", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "a", " ", "slice", " ", "id", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "the", " ", "original", " ", "T2", "star", " ", "image", " ", "crop", " ", "aro", "und", " ", "the", " ", "spin", "al", " ", "cord", ":", " ", "im", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "a", " ", "manu", "al", " ", "segmentation", " ", "of", " ", "the", " ", "gray", " ", "matte", "r", ":", " ", "seg", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", " ", "slice", "s", ":", " ", "nump", "y", " ", "array", " ", "of", " ", "all", " ", "the", " ", "slice", "s", " ", "of", " ", "the", " ", "data", " ", "dictionar", "y", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "initialization", "_", "\\u\\u\\uNL\\u\\u\\u_", "slices_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total", "\\u", "j", "\\u", "im_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total", "\\u", "j", "\\u", "seg_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "change", " ", "the", " ", "name", " ", "of", " ", "files", " ", "to", " ", "find", " ", "to", " ", "a", " ", "more", " ", "genera", "l", " ", "structure_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "subject", "\\u", "dir_", "in_", "os_", "._", "listdir_", "(_", "self_", "._", "param_", "._", "path", "\\u", "dictionary_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subject", "\\u", "path_", "=_", "self_", "._", "param_", "._", "path", "\\u", "dictionary_", "+_", "'/'_", "+_", "subject", "\\u", "dir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "subject", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "dic", "\\u", "data\\u", "info_", "[_", "subject", "\\u", "dir_", "]_", "=_", "{_", "'", "n", "\\u", "slice", "s", "'_", ":_", "0_", ",_", "'", "inverted", "\\u", "gm", "\\u", "seg", "'_", ":_", "[_", "]_", ",_", "'", "im", "\\u", "M", "'_", ":_", "[_", "]_", ",_", "'", "seg", "\\u", "M", "'_", ":_", "[_", "]_", ",_", "'", "level", "s", "'_", ":_", "[_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j", "\\u", "im_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j", "\\u", "seg_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "first", "\\u", "slice_", "=_", "total", "\\u", "j", "\\u", "im_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "run_", "(_", "'", "mkd", "ir", " ", "'_", "+_", "self_", "._", "model", "\\u", "dic", "\\u", "name_", "+_", "'/'_", "+_", "subject", "\\u", "dir_", ",_", "verbose_", "=_", "self_", "._", "param_", "._", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "file", "\\u", "name_", "in_", "os_", "._", "listdir_", "(_", "subject", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "'", "im", "'_", "in_", "file", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "slice", "\\u", "level_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name", "\\u", "list_", "=_", "file", "\\u", "name_", "._", "split_", "(_", "'\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "word_", "in_", "name", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "word_", "in_", "self_", "._", "level", "\\u", "label_", "._", "values_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "slice", "\\u", "level_", "=_", "get", "\\u", "key", "\\u", "from", "\\u", "val_", "(_", "self_", "._", "level", "\\u", "label_", ",_", "word_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "slices_", "._", "append_", "(_", "Slice_", "(_", "slice", "\\u", "id_", "=_", "total", "\\u", "j", "\\u", "im_", ",_", "im_", "=_", "Image_", "(_", "subject", "\\u", "path_", "+_", "'/'_", "+_", "file", "\\u", "name_", ")_", "._", "data_", ",_", "level_", "=_", "slice", "\\u", "level_", ",_", "reg", "\\u", "to", "\\u", "m_", "=_", "[_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dic", "\\u", "data\\u", "info_", "[_", "subject", "\\u", "dir_", "]_", "[_", "'", "level", "s", "'_", "]_", "._", "append_", "(_", "slice", "\\u", "level_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "copy", " ", "of", " ", "the", " ", "slice", " ", "image", " ", "in", " ", "the", " ", "saved", " ", "model", " ", "folder_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "j", "\\u", "im_", "<_", "10_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "j", "\\u", "im", "\\u", "str_", "=_", "str_", "(_", "j", "\\u", "im_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j", "\\u", "im", "\\u", "str_", "=_", "'", "0", "'_", "+_", "j", "\\u", "im", "\\u", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "j", "\\u", "im", "\\u", "str_", "=_", "str_", "(_", "j", "\\u", "im_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "im", "\\u", "file", "\\u", "name_", "=_", "subject", "\\u", "dir_", "+_", "'\\u", "slice", "'_", "+_", "j", "\\u", "im", "\\u", "str_", "+_", "'\\u'_", "+_", "self_", "._", "level", "\\u", "label_", "[_", "slice", "\\u", "level_", "]_", "+_", "'\\u", "im", ".", "ni", "i", ".", "gz", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "run_", "(_", "'", "cp", " ", "./", "'_", "+_", "self_", "._", "param_", "._", "path", "\\u", "dictionary_", "+_", "'/'_", "+_", "subject", "\\u", "dir_", "+_", "'/'_", "+_", "file", "\\u", "name_", "+_", "'", " ", "'_", "+_", "self_", "._", "model", "\\u", "dic", "\\u", "name_", "+_", "'/'_", "+_", "subject", "\\u", "dir_", "+_", "'/'_", "+_", "im", "\\u", "file", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j", "\\u", "im_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total", "\\u", "j", "\\u", "im_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "seg", "'_", "in_", "file", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "slices_", "[_", "total", "\\u", "j", "\\u", "seg_", "]_", "._", "set_", "(_", "gm", "\\u", "seg_", "=_", "Image_", "(_", "subject", "\\u", "path_", "+_", "'/'_", "+_", "file", "\\u", "name_", ")_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j", "\\u", "seg_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total", "\\u", "j", "\\u", "seg_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "j", "\\u", "im_", "==_", "j", "\\u", "seg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "dic", "\\u", "data\\u", "info_", "[_", "subject", "\\u", "dir_", "]_", "[_", "'", "n", "\\u", "slice", "s", "'_", "]_", "=_", "(_", "first", "\\u", "slice_", ",_", "total", "\\u", "j", "\\u", "im_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sct", "_", "._", "print", "v_", "(_", "'", "ERROR", ":", " ", "subject", " ", "'_", "+_", "subject", "\\u", "dir_", "+_", "'", " ", "doe", "sn", "\\\\'", "t", " ", "have", " ", "the", " ", "same", " ", "number", " ", "of", " ", "slice", " ", "images", " ", "and", " ", "segmentation", "s", "'_", ",_", "verbose_", "=_", "self_", "._", "param_", "._", "verbose_", ",_", "type_", "=_", "'", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "np_", "._", "asarray_", "(_", "slices_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Dict", "ionar", "y", "By", "Slice_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save", "\\u", "model", "\\u", "data_", "(_", "self_", ",_", "what", "\\u", "to", "\\u", "save_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "save", " ", "3", "D", " ", "images", " ", "of", " ", "the", " ", "model", " ", "dictionar", "y", " ", "usi", "ng", " ", "the", " ", "dictionar", "y", " ", "of", " ", "informati", "on", " ", "abo", "ut", " ", "the", " ", "data", " ", "slice", "s", " ", "by", " ", "subject", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "what", "\\u", "to", "\\u", "save", ":", " ", "type", " ", "of", " ", "data", " ", "to", " ", "be", " ", "saved", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suffix_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "to", "\\u", "save_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "what", "\\u", "to", "\\u", "save_", "==_", "'", "gm", "\\u", "seg", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "suffix_", "=_", "'\\u", "gm", "\\u", "seg", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "to", "\\u", "save_", "=_", "[_", "dic", "\\u", "slice_", "._", "gm", "\\u", "seg_", "for_", "dic", "\\u", "slice_", "in_", "self_", "._", "slices_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "what", "\\u", "to", "\\u", "save_", "==_", "'", "inverted", "\\u", "gm", "\\u", "seg", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "suffix_", "=_", "'\\u", "wm", "\\u", "seg", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "to", "\\u", "save_", "=_", "[_", "dic", "\\u", "slice_", "._", "wm", "\\u", "seg_", "for_", "dic", "\\u", "slice_", "in_", "self_", "._", "slices_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "what", "\\u", "to", "\\u", "save_", "==_", "'", "im", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "suffix_", "=_", "'\\u", "im", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "to", "\\u", "save_", "=_", "[_", "dic", "\\u", "slice_", "._", "im_", "for_", "dic", "\\u", "slice_", "in_", "self_", "._", "slices_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "what", "\\u", "to", "\\u", "save_", "==_", "'", "im", "\\u", "M", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "suffix_", "=_", "'\\u", "im", "\\u", "model", "\\u", "space", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "to", "\\u", "save_", "=_", "[_", "dic", "\\u", "slice_", "._", "im", "\\u", "M_", "for_", "dic", "\\u", "slice_", "in_", "self_", "._", "slices_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "what", "\\u", "to", "\\u", "save_", "==_", "'", "gm", "\\u", "seg", "\\u", "M", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "suffix_", "=_", "'\\u", "gm", "\\u", "seg", "\\u", "model", "\\u", "space", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "to", "\\u", "save_", "=_", "[_", "dic", "\\u", "slice_", "._", "gm", "\\u", "seg", "\\u", "M_", "for_", "dic", "\\u", "slice_", "in_", "self_", "._", "slices_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "what", "\\u", "to", "\\u", "save_", "==_", "'", "wm", "\\u", "seg", "\\u", "M", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "suffix_", "=_", "'\\u", "wm", "\\u", "seg", "\\u", "model", "\\u", "space", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "to", "\\u", "save_", "=_", "[_", "dic", "\\u", "slice_", "._", "wm", "\\u", "seg", "\\u", "M_", "for_", "dic", "\\u", "slice_", "in_", "self_", "._", "slices_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "subject", "\\u", "name_", "in_", "sorted_", "(_", "self_", "._", "dic", "\\u", "data\\u", "info_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "first", "\\u", "subject", "\\u", "slice_", ",_", "last", "\\u", "subject", "\\u", "slice_", "=_", "self_", "._", "dic", "\\u", "data\\u", "info_", "[_", "subject", "\\u", "name_", "]_", "[_", "'", "n", "\\u", "slice", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dic", "\\u", "data\\u", "info_", "[_", "subject", "\\u", "name_", "]_", "[_", "what", "\\u", "to", "\\u", "save_", "]_", "=_", "data\\u", "to", "\\u", "save_", "[_", "first", "\\u", "subject", "\\u", "slice_", ":_", "last", "\\u", "subject", "\\u", "slice_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", ",_", "slice", "\\u", "i_", "in_", "enumerate_", "(_", "self_", "._", "dic", "\\u", "data\\u", "info_", "[_", "subject", "\\u", "name_", "]_", "[_", "what", "\\u", "to", "\\u", "save_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "to", "\\u", "save_", "=_", "Image_", "(_", "param_", "=_", "np_", "._", "asarray_", "(_", "slice", "\\u", "i_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "save_", "._", "path_", "=_", "self_", "._", "model", "\\u", "dic", "\\u", "name_", "+_", "'/'_", "+_", "subject", "\\u", "name_", "+_", "'/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "i_", "<_", "10_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "i", "\\u", "str_", "=_", "str_", "(_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i", "\\u", "str_", "=_", "'", "0", "'_", "+_", "i", "\\u", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "i", "\\u", "str_", "=_", "str_", "(_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "to", "\\u", "save_", "._", "file", "\\u", "name_", "=_", "subject", "\\u", "name_", "+_", "'\\u", "slice", "'_", "+_", "i", "\\u", "str_", "+_", "'\\u'_", "+_", "self_", "._", "level", "\\u", "label_", "[_", "self_", "._", "dic", "\\u", "data\\u", "info_", "[_", "subject", "\\u", "name_", "]_", "[_", "'", "level", "s", "'_", "]_", "[_", "i_", "]_", "]_", "+_", "suffix_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "save_", "._", "ext_", "=_", "'.", "ni", "i", ".", "gz", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "save_", "._", "save_", "(_", "type_", "=_", "'", "minimize", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Dict", "ionar", "y", "By", "Slice_", ":_", "\\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_", "invert", "\\u", "seg_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Invert", " ", "the", " ", "gray", " ", "matte", "r", " ", "segmentation", " ", "to", " ", "get", " ", "segmentation", " ", "of", " ", "the", " ", "white", " ", "matte", "r", " ", "inst", "ead", "\\", "10", ";", " ", " ", " ", " ", "keep", "s", " ", "more", " ", "informati", "on", ",", " ", "theore", "tica", "ll", "y", " ", "bett", "er", " ", "results", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "dic", "\\u", "slice_", "in_", "self_", "._", "slices_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "im", "\\u", "dic_", "=_", "Image_", "(_", "param_", "=_", "dic", "\\u", "slice_", "._", "im_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sc_", "=_", "im", "\\u", "dic_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nz", "\\u", "coord", "\\u", "sc_", "=_", "sc_", "._", "get", "Non", "Zero", "Coordinates_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "\\u", "seg_", "=_", "Image_", "(_", "param_", "=_", "dic", "\\u", "slice_", "._", "gm", "\\u", "seg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nz", "\\u", "coord", "\\u", "d_", "=_", "im", "\\u", "seg_", "._", "get", "Non", "Zero", "Coordinates_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "coord_", "in_", "nz", "\\u", "coord", "\\u", "sc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sc_", "._", "data_", "[_", "coord_", "._", "x_", ",_", "coord_", "._", "y_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "coord_", "in_", "nz", "\\u", "coord", "\\u", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "im", "\\u", "seg_", "._", "data_", "[_", "coord_", "._", "x_", ",_", "coord_", "._", "y_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "cast", " ", "of", " ", "the", " ", "-1", " ", "values", " ", "(-", ">", " ", "GM", " ", "pixel", " ", "at", " ", "the", " ", "exteri", "or", " ", "of", " ", "the", " ", "SC", " ", "pixel", "s", ")", " ", "to", " ", "+", "1", " ", "-->", " ", "WM", " ", "pixel_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "inverted", "\\u", "slice", "\\u", "decision_", "=_", "np_", "._", "absolute_", "(_", "sc_", "._", "data_", "-_", "im", "\\u", "seg_", "._", "data_", ")_", "._", "astype_", "(_", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dic", "\\u", "slice_", "._", "set_", "(_", "wm", "\\u", "seg_", "=_", "inverted", "\\u", "slice", "\\u", "decision_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Dict", "ionar", "y", "By", "Slice_", ":_", "\\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_", "seg", "\\u", "core", "gist", "ration", "_", "(_", "self_", ",_", "transf", "o", "\\u", "to", "\\u", "apply_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "all", " ", "the", " ", "segmentation", " ", "slice", "s", ",", " ", "do", " ", "a", " ", "registration", " ", "of", " ", "the", " ", "segmentation", " ", "slice", " ", "to", " ", "the", " ", "mean", " ", "segmentation", "\\", "10", ";", " ", " ", " ", " ", " ", "appl", "ying", " ", "all", " ", "the", " ", "transformation", "s", " ", "in", " ", "transf", "o", "\\u", "to", "\\u", "appl", "y", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Compute", ",", " ", "appl", "y", " ", "and", " ", "save", " ", "each", " ", "transformation", " ", "warp", "ing", " ", "field", " ", "for", " ", "all", " ", "the", " ", "segmentation", " ", "slice", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Compute", " ", "the", " ", "new", " ", "mean", " ", "segmentation", " ", "at", " ", "each", " ", "step", " ", "and", " ", "update", " ", "self", ".", "mean", "\\u", "seg", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "transf", "o", "\\u", "to", "\\u", "appl", "y", ":", " ", "list", " ", "of", " ", "string", "\\", "10", ";", " ", " ", " ", " ", ":", "return", ":", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "param_", "._", "seg", "\\u", "type_", "==_", "'", "gm", "-", "model", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "current", "\\u", "mean", "\\u", "seg_", "=_", "compute", "\\u", "major", "it", "y", "\\u", "vote", "\\u", "mean", "\\u", "seg_", "(_", "np_", "._", "asarray_", "(_", "[_", "dic", "\\u", "slice_", "._", "gm", "\\u", "seg_", "for_", "dic", "\\u", "slice_", "in_", "self_", "._", "slices_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "current", "\\u", "mean", "\\u", "seg_", "=_", "compute", "\\u", "major", "it", "y", "\\u", "vote", "\\u", "mean", "\\u", "seg_", "(_", "np_", "._", "asarray_", "(_", "[_", "dic", "\\u", "slice_", "._", "wm", "\\u", "seg_", "for_", "dic", "\\u", "slice_", "in_", "self_", "._", "slices_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "transf", "o_", "in_", "transf", "o", "\\u", "to", "\\u", "apply_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sct", "_", "._", "print", "v_", "(_", "'", "Do", "ing", " ", "a", " ", "'_", "+_", "transf", "o_", "+_", "'", " ", "registration", " ", "of", " ", "each", " ", "segmentation", " ", "slice", " ", "to", " ", "the", " ", "mean", " ", "segmentation", " ", "...'_", ",_", "self_", "._", "param_", "._", "verbose_", ",_", "'", "normal", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "mean", "\\u", "seg_", "=_", "self_", "._", "find", "\\u", "core", "gist", "ration", "_", "(_", "mean", "\\u", "seg_", "=_", "current", "\\u", "mean", "\\u", "seg_", ",_", "transf", "o", "\\u", "type_", "=_", "transf", "o_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result", "ing", "\\u", "mean", "\\u", "seg_", "=_", "current", "\\u", "mean", "\\u", "seg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "result", "ing", "\\u", "mean", "\\u", "seg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Dict", "ionar", "y", "By", "Slice_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "find", "\\u", "core", "gist", "ration", "_", "(_", "self_", ",_", "mean", "\\u", "seg_", "=_", "None_", ",_", "transf", "o", "\\u", "type_", "=_", "'", "Rig", "id", "'_", ",_", "first_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "each", " ", "segmentation", " ", "slice", ",", " ", "appl", "y", " ", "and", " ", "save", " ", "a", " ", "registration", " ", "of", " ", "the", " ", "specified", " ", "type", " ", "of", " ", "transformation", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "name", " ", "of", " ", "the", " ", "registration", " ", "file", " ", "(", "usual", "ly", " ", "a", " ", "matlab", " ", "matrix", ")", " ", "is", " ", "saved", " ", "in", " ", "self", ".", "Rt", "o", "M", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "mean", "\\u", "seg", ":", " ", "current", " ", "mean", " ", "segmentation", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "transf", "o", "\\u", "type", ":", " ", "type", " ", "of", " ", "transformation", " ", "for", " ", "the", " ", "registration", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", " ", "mean", " ", "seg", ":", " ", "update", "d", " ", "mean", " ", "segmentation", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "param_", "._", "seg", "\\u", "type_", "==_", "'", "gm", "-", "model", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Core", "gist", "rai", "on", " ", "of", " ", "the", " ", "gray", " ", "matte", "r", " ", "segmentation", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "dic", "\\u", "slice_", "in_", "self_", "._", "slices_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name", "\\u", "j", "\\u", "transform_", "=_", "'", "transform", "\\u", "slice", "\\u'_", "+_", "str_", "(_", "dic", "\\u", "slice_", "._", "id_", ")_", "+_", "find", "\\u", "ant", "s", "\\u", "transf", "o", "\\u", "name_", "(_", "transf", "o", "\\u", "type_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "reg", "\\u", "list_", "=_", "dic", "\\u", "slice_", "._", "reg", "\\u", "to", "\\u", "M_", "._", "append_", "(_", "name", "\\u", "j", "\\u", "transform_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dic", "\\u", "slice_", "._", "set_", "(_", "reg", "\\u", "to", "\\u", "m_", "=_", "new", "\\u", "reg", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "first_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "seg", "\\u", "m_", "=_", "appl", "y", "\\u", "ant", "s", "\\u", "transf", "o_", "(_", "mean", "\\u", "seg_", ",_", "dic", "\\u", "slice_", "._", "gm", "\\u", "seg_", ",_", "transf", "o", "\\u", "name_", "=_", "name", "\\u", "j", "\\u", "transform_", ",_", "path_", "=_", "self_", "._", "model", "\\u", "dic", "\\u", "name_", "+_", "'/'_", ",_", "transf", "o", "\\u", "type_", "=_", "transf", "o", "\\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 ", " ", "_", "seg", "\\u", "m_", "=_", "appl", "y", "\\u", "ant", "s", "\\u", "transf", "o_", "(_", "mean", "\\u", "seg_", ",_", "dic", "\\u", "slice_", "._", "gm", "\\u", "seg", "\\u", "M_", ",_", "transf", "o", "\\u", "name_", "=_", "name", "\\u", "j", "\\u", "transform_", ",_", "path_", "=_", "self_", "._", "model", "\\u", "dic", "\\u", "name_", "+_", "'/'_", ",_", "transf", "o", "\\u", "type_", "=_", "transf", "o", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dic", "\\u", "slice_", "._", "set_", "(_", "gm", "\\u", "seg", "\\u", "m_", "=_", "seg", "\\u", "m_", "._", "astype_", "(_", "int_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dic", "\\u", "slice_", "._", "set_", "(_", "gm", "\\u", "seg", "\\u", "m", "\\u", "flat_", "=_", "seg", "\\u", "m_", "._", "flatten_", "(_", ")_", "._", "astype_", "(_", "int_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mean", "\\u", "seg_", "=_", "compute", "\\u", "major", "it", "y", "\\u", "vote", "\\u", "mean", "\\u", "seg_", "(_", "[_", "dic", "\\u", "slice_", "._", "gm", "\\u", "seg", "\\u", "M_", "for_", "dic", "\\u", "slice_", "in_", "self_", "._", "slices_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Core", "gist", "rai", "on", " ", "of", " ", "the", " ", "white", " ", "matte", "r", " ", "segmentation", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "dic", "\\u", "slice_", "in_", "self_", "._", "slices_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name", "\\u", "j", "\\u", "transform_", "=_", "'", "transform", "\\u", "slice", "\\u'_", "+_", "str_", "(_", "dic", "\\u", "slice_", "._", "id_", ")_", "+_", "find", "\\u", "ant", "s", "\\u", "transf", "o", "\\u", "name_", "(_", "transf", "o", "\\u", "type_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "reg", "\\u", "list_", "=_", "dic", "\\u", "slice_", "._", "reg", "\\u", "to", "\\u", "M_", "._", "append_", "(_", "name", "\\u", "j", "\\u", "transform_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dic", "\\u", "slice_", "._", "set_", "(_", "reg", "\\u", "to", "\\u", "m_", "=_", "new", "\\u", "reg", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "first_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "seg", "\\u", "m_", "=_", "appl", "y", "\\u", "ant", "s", "\\u", "transf", "o_", "(_", "mean", "\\u", "seg_", ",_", "dic", "\\u", "slice_", "._", "wm", "\\u", "seg_", ",_", "transf", "o", "\\u", "name_", "=_", "name", "\\u", "j", "\\u", "transform_", ",_", "path_", "=_", "self_", "._", "model", "\\u", "dic", "\\u", "name_", "+_", "'/'_", ",_", "transf", "o", "\\u", "type_", "=_", "transf", "o", "\\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 ", " ", "_", "seg", "\\u", "m_", "=_", "appl", "y", "\\u", "ant", "s", "\\u", "transf", "o_", "(_", "mean", "\\u", "seg_", ",_", "dic", "\\u", "slice_", "._", "wm", "\\u", "seg", "\\u", "M_", ",_", "transf", "o", "\\u", "name_", "=_", "name", "\\u", "j", "\\u", "transform_", ",_", "path_", "=_", "self_", "._", "model", "\\u", "dic", "\\u", "name_", "+_", "'/'_", ",_", "transf", "o", "\\u", "type_", "=_", "transf", "o", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dic", "\\u", "slice_", "._", "set_", "(_", "wm", "\\u", "seg", "\\u", "m_", "=_", "seg", "\\u", "m_", "._", "astype_", "(_", "int_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dic", "\\u", "slice_", "._", "set_", "(_", "wm", "\\u", "seg", "\\u", "m", "\\u", "flat_", "=_", "seg", "\\u", "m_", "._", "flatten_", "(_", ")_", "._", "astype_", "(_", "int_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mean", "\\u", "seg_", "=_", "compute", "\\u", "major", "it", "y", "\\u", "vote", "\\u", "mean", "\\u", "seg_", "(_", "[_", "dic", "\\u", "slice_", "._", "wm", "\\u", "seg", "\\u", "M_", "for_", "dic", "\\u", "slice_", "in_", "self_", "._", "slices_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "save", "\\u", "image_", "(_", "mean", "\\u", "seg_", ",_", "'", "mean", "\\u", "seg", "'_", ",_", "path_", "=_", "self_", "._", "model", "\\u", "dic", "\\u", "name_", "+_", "'/'_", ",_", "im", "\\u", "type_", "=_", "'", "uint", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "mean", "\\u", "seg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Dict", "ionar", "y", "By", "Slice_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compute", "\\u", "mean", "\\u", "dic", "\\u", "image_", "(_", "self_", ",_", "im", "\\u", "data\\u", "set_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Compute", " ", "the", " ", "mean", " ", "image", " ", "of", " ", "the", " ", "dictionar", "y", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Us", "ed", " ", "to", " ", "co", "-", "register", " ", "the", " ", "dictionar", "y", " ", "images", " ", "int", "o", " ", "te", "h", " ", "common", " ", "group", "wis", "e", " ", "space", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "im", "\\u", "data\\u", "set", ":", "\\", "10", ";", " ", " ", " ", " ", ":", "return", " ", "mean", ":", " ", "mean", " ", "image", " ", "of", " ", "the", " ", "input", " ", "data", " ", "set", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mean_", "=_", "np_", "._", "sum_", "(_", "im", "\\u", "data\\u", "set_", ",_", "axis_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mean_", "/=_", "float_", "(_", "self_", "._", "J_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "mean_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Dict", "ionar", "y", "By", "Slice_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "core", "gister", "\\u", "data_", "(_", "self_", ",_", "transf", "o", "\\u", "to", "\\u", "apply_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Apply", " ", "to", " ", "each", " ", "image", " ", "slice", " ", "of", " ", "the", " ", "dictionar", "y", " ", "the", " ", "transformation", "s", " ", "found", " ", "register", "ing", " ", "the", " ", "segmentation", " ", "slice", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "co", "\\u", "register", "ed", " ", "images", " ", "are", " ", "saved", " ", "for", " ", "each", " ", "slice", " ", "as", " ", "im", "\\u", "M", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "transf", "o", "\\u", "to", "\\u", "appl", "y", ":", " ", "list", " ", "of", " ", "string", "\\", "10", ";", " ", " ", " ", " ", ":", "return", ":", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "im_", "=_", "[_", "dic", "\\u", "slice_", "._", "im_", "for_", "dic", "\\u", "slice_", "in_", "self_", "._", "slices_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "gm", "\\u", "seg_", "=_", "[_", "dic", "\\u", "slice_", "._", "gm", "\\u", "seg_", "for_", "dic", "\\u", "slice_", "in_", "self_", "._", "slices_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "dic", "\\u", "slice_", "in_", "self_", "._", "slices_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "n", "\\u", "transf", "o_", ",_", "transf", "o_", "in_", "enumerate_", "(_", "transf", "o", "\\u", "to", "\\u", "apply_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "im", "\\u", "m_", "=_", "appl", "y", "\\u", "ant", "s", "\\u", "transf", "o_", "(_", "self_", "._", "compute", "\\u", "mean", "\\u", "dic", "\\u", "image_", "(_", "list", "\\u", "im_", ")_", ",_", "dic", "\\u", "slice_", "._", "im_", ",_", "search", "\\u", "reg_", "=_", "False_", ",_", "transf", "o", "\\u", "name_", "=_", "dic", "\\u", "slice_", "._", "reg", "\\u", "to", "\\u", "M_", "[_", "n", "\\u", "transf", "o_", "]_", ",_", "binary_", "=_", "False_", ",_", "path_", "=_", "self_", "._", "model", "\\u", "dic", "\\u", "name_", "+_", "'/'_", ",_", "transf", "o", "\\u", "type_", "=_", "transf", "o_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "appl", "y", "\\u", "2", "D", "\\u", "rigid", "\\u", "transformation", "(", "self", ".", "im", "[", "j", "],", " ", "self", ".", "RM", "[", "j", "]['", "tx", "']", ",", " ", "self", ".", "RM", "[", "j", "]['", "ty", "']", ",", " ", "self", ".", "RM", "[", "j", "]['", "theta", "'])", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "param_", "._", "seg", "\\u", "type_", "==_", "'", "gm", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "gm", "\\u", "seg", "\\u", "m_", "=_", "appl", "y", "\\u", "ant", "s", "\\u", "transf", "o_", "(_", "self_", "._", "compute", "\\u", "mean", "\\u", "dic", "\\u", "image_", "(_", "list", "\\u", "gm", "\\u", "seg_", ")_", ",_", "dic", "\\u", "slice_", "._", "gm", "\\u", "seg_", ",_", "search", "\\u", "reg_", "=_", "False_", ",_", "transf", "o", "\\u", "name_", "=_", "dic", "\\u", "slice_", "._", "reg", "\\u", "to", "\\u", "M_", "[_", "n", "\\u", "transf", "o_", "]_", ",_", "binary_", "=_", "False_", ",_", "path_", "=_", "self_", "._", "model", "\\u", "dic", "\\u", "name_", "+_", "'/'_", ",_", "transf", "o", "\\u", "type_", "=_", "transf", "o_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dic", "\\u", "slice_", "._", "set_", "(_", "im", "\\u", "m_", "=_", "im", "\\u", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dic", "\\u", "slice_", "._", "set_", "(_", "im", "\\u", "m", "\\u", "flat_", "=_", "im", "\\u", "m_", "._", "flatten_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "param_", "._", "seg", "\\u", "type_", "==_", "'", "gm", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dic", "\\u", "slice_", "._", "set_", "(_", "gm", "\\u", "seg", "\\u", "m_", "=_", "gm", "\\u", "seg", "\\u", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dic", "\\u", "slice_", "._", "set_", "(_", "gm", "\\u", "seg", "\\u", "m", "\\u", "flat_", "=_", "gm", "\\u", "seg", "\\u", "m_", "._", "flatten_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Dict", "ionar", "y", "By", "Slice_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load", "\\u", "model", "\\u", "dictionary_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Load", " ", "the", " ", "model", " ", "dictionar", "y", " ", "from", " ", "a", " ", "saved", " ", "one", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "itertools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Load", "ing", " ", "the", " ", "model", " ", "dictionar", "y", " ", "...'_", ",_", "self_", "._", "param_", "._", "verbose_", ",_", "'", "normal", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "j", "\\u", "im_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j", "\\u", "seg_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j", "\\u", "im", "\\u", "m_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j", "\\u", "seg", "\\u", "m_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "subject", "\\u", "dir_", "in_", "os_", "._", "listdir_", "(_", "self_", "._", "model", "\\u", "dic", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subject", "\\u", "path_", "=_", "self_", "._", "model", "\\u", "dic", "\\u", "name_", "+_", "'/'_", "+_", "subject", "\\u", "dir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "subject", "\\u", "path_", ")_", "and_", "'", "transformation", "s", "'_", "not_", "in_", "subject", "\\u", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "file", "\\u", "name_", "in_", "os_", "._", "listdir_", "(_", "subject", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "'\\u", "im", ".", "ni", "i", "'_", "in_", "file", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "reg", "\\u", "list_", "=_", "[_", "'", "transform", "\\u", "slice", "\\u'_", "+_", "str_", "(_", "j", "\\u", "im_", ")_", "+_", "find", "\\u", "ant", "s", "\\u", "transf", "o", "\\u", "name_", "(_", "transf", "o", "\\u", "type_", ")_", "[_", "0_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "transf", "o", "\\u", "type_", "in_", "self_", "._", "core", "gist", "ration", "\\u", "transf", "os_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "slice", "\\u", "level_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name", "\\u", "list_", "=_", "file", "\\u", "name_", "._", "split_", "(_", "'\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "word_", "in_", "name", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "word_", "in_", "self_", "._", "level", "\\u", "label_", "._", "values_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "slice", "\\u", "level_", "=_", "get", "\\u", "key", "\\u", "from", "\\u", "val_", "(_", "self_", "._", "level", "\\u", "label_", ",_", "word_", ")_", "\\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_", "._", "slices_", "._", "append_", "(_", "Slice_", "(_", "slice", "\\u", "id_", "=_", "j", "\\u", "im_", ",_", "im_", "=_", "Image_", "(_", "subject", "\\u", "path_", "+_", "'/'_", "+_", "file", "\\u", "name_", ")_", "._", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "level_", "=_", "slice", "\\u", "level_", ",_", "reg", "\\u", "to", "\\u", "m_", "=_", "reg", "\\u", "list_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j", "\\u", "im_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'\\u", "seg", ".", "ni", "i", "'_", "in_", "file", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "slices_", "[_", "j", "\\u", "seg_", "]_", "._", "set_", "(_", "seg_", "=_", "Image_", "(_", "subject", "\\u", "path_", "+_", "'/'_", "+_", "file", "\\u", "name_", ")_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j", "\\u", "seg_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'\\u", "im", "\\u", "model", "\\u", "space", ".", "ni", "i", "'_", "in_", "file", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "im", "\\u", "m", "\\u", "slice_", "=_", "Image_", "(_", "subject", "\\u", "path_", "+_", "'/'_", "+_", "file", "\\u", "name_", ")_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "slices_", "[_", "j", "\\u", "im", "\\u", "m_", "]_", "._", "set_", "(_", "im", "\\u", "m_", "=_", "im", "\\u", "m", "\\u", "slice_", ",_", "im", "\\u", "m", "\\u", "flat_", "=_", "im", "\\u", "m", "\\u", "slice_", "._", "flatten_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j", "\\u", "im", "\\u", "m_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'\\u", "seg", "\\u", "model", "\\u", "space", ".", "ni", "i", "'_", "in_", "file", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "seg", "\\u", "m", "\\u", "slice_", "=_", "Image_", "(_", "subject", "\\u", "path_", "+_", "'/'_", "+_", "file", "\\u", "name_", ")_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "slices_", "[_", "j", "\\u", "seg", "\\u", "m_", "]_", "._", "set_", "(_", "seg", "\\u", "m_", "=_", "seg", "\\u", "m", "\\u", "slice_", ",_", "seg", "\\u", "m", "\\u", "flat_", "=_", "seg", "\\u", "m", "\\u", "slice_", "._", "flatten_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j", "\\u", "seg", "\\u", "m_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "number", " ", "of", " ", "atlas", "es", " ", "in", " ", "the", " ", "dictionary_", "\\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_", "self_", "._", "J_", "=_", "len_", "(_", "self_", "._", "slices_", ")_", "#", " ", "len", "([", "slice", ".", "im", " ", "for", " ", "slice", " ", "in", " ", "self", ".", "slice", "s", "])", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dimension", " ", "of", " ", "the", " ", "data", " ", "(", "flat", "ten", " ", "slice", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "N_", "=_", "len_", "(_", "self_", "._", "slices_", "[_", "0_", "]_", "._", "im", "\\u", "M_", "._", "flatten_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mean", "\\u", "image_", "=_", "Image_", "(_", "self_", "._", "model", "\\u", "dic", "\\u", "name_", "+_", "'/", "mean", "\\u", "image", ".", "ni", "i", ".", "gz", "'_", ")_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mean", "\\u", "seg_", "=_", "Image_", "(_", "self_", "._", "model", "\\u", "dic", "\\u", "name_", "+_", "'/", "mean", "\\u", "seg", ".", "ni", "i", ".", "gz", "'_", ")_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Dict", "ionar", "y", "By", "Slice_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "show", "\\u", "data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "show", " ", "the", " ", "10", " ", "first", " ", "slice", "s", " ", "of", " ", "the", " ", "model", " ", "dictionar", "y", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "dic", "\\u", "slice_", "in_", "self_", "._", "slices_", "[_", ":_", "10_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fig_", "=_", "plt_", "._", "figure_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "seg", "\\u", "subplot_", "=_", "fig_", "._", "add", "\\u", "subplot_", "(_", "2_", ",_", "3_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seg", "\\u", "subplot_", "._", "set\\u", "title_", "(_", "'", "Origina", "l", " ", "space", " ", "-", " ", "seg", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "\\u", "seg_", "=_", "seg", "\\u", "subplot_", "._", "imshow_", "(_", "dic", "\\u", "slice_", "._", "wm", "\\u", "seg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "\\u", "seg_", "._", "set\\u", "interpolation_", "(_", "'", "near", "est", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "\\u", "seg_", "._", "set\\u", "cmap_", "(_", "'", "gray", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "seg", "\\u", "m", "\\u", "subplot_", "=_", "fig_", "._", "add", "\\u", "subplot_", "(_", "2_", ",_", "3_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seg", "\\u", "m", "\\u", "subplot_", "._", "set\\u", "title_", "(_", "'", "Common", " ", "group", "wis", "e", " ", "space", " ", "-", " ", "seg", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "\\u", "seg", "\\u", "m_", "=_", "seg", "\\u", "m", "\\u", "subplot_", "._", "imshow_", "(_", "dic", "\\u", "slice_", "._", "wm", "\\u", "seg", "\\u", "M_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "\\u", "seg", "\\u", "m_", "._", "set\\u", "interpolation_", "(_", "'", "near", "est", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "\\u", "seg", "\\u", "m_", "._", "set\\u", "cmap_", "(_", "'", "gray", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mean", "\\u", "seg", "\\u", "subplot_", "=_", "fig_", "._", "add", "\\u", "subplot_", "(_", "2_", ",_", "3_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mean", "\\u", "seg", "\\u", "subplot_", "._", "set\\u", "title_", "(_", "'", "Mea", "n", " ", "seg", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "\\u", "mean", "\\u", "seg_", "=_", "mean", "\\u", "seg", "\\u", "subplot_", "._", "imshow_", "(_", "np_", "._", "asarray_", "(_", "self_", "._", "mean", "\\u", "seg_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "\\u", "mean", "\\u", "seg_", "._", "set\\u", "interpolation_", "(_", "'", "near", "est", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "\\u", "mean", "\\u", "seg_", "._", "set\\u", "cmap_", "(_", "'", "gray", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "slice", "\\u", "im", "\\u", "subplot_", "=_", "fig_", "._", "add", "\\u", "subplot_", "(_", "2_", ",_", "3_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slice", "\\u", "im", "\\u", "subplot_", "._", "set\\u", "title_", "(_", "'", "Origina", "l", " ", "space", " ", "-", " ", "data", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "\\u", "slice", "\\u", "im_", "=_", "slice", "\\u", "im", "\\u", "subplot_", "._", "imshow_", "(_", "dic", "\\u", "slice_", "._", "im_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "\\u", "slice", "\\u", "im_", "._", "set\\u", "interpolation_", "(_", "'", "near", "est", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "\\u", "slice", "\\u", "im_", "._", "set\\u", "cmap_", "(_", "'", "gray", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "slice", "\\u", "im", "\\u", "m", "\\u", "subplot_", "=_", "fig_", "._", "add", "\\u", "subplot_", "(_", "2_", ",_", "3_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slice", "\\u", "im", "\\u", "m", "\\u", "subplot_", "._", "set\\u", "title_", "(_", "'", "Common", " ", "group", "wis", "e", " ", "space", " ", "-", " ", "data", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "\\u", "slice", "\\u", "im", "\\u", "m_", "=_", "slice", "\\u", "im", "\\u", "m", "\\u", "subplot_", "._", "imshow_", "(_", "dic", "\\u", "slice_", "._", "im", "\\u", "M_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "\\u", "slice", "\\u", "im", "\\u", "m_", "._", "set\\u", "interpolation_", "(_", "'", "near", "est", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "\\u", "slice", "\\u", "im", "\\u", "m_", "._", "set\\u", "cmap_", "(_", "'", "gray", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plt_", "._", "suptitle_", "(_", "'", "Slice", " ", "'_", "+_", "str_", "(_", "dic", "\\u", "slice_", "._", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "show_", "(_", ")_", "\\u\\u\\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_", "Model_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Model", " ", "used", " ", "by", " ", "the", " ", "supervis", "ed", " ", "gray", " ", "matte", "r", " ", "segmentation", " ", "method", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Model_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "model", "\\u", "param_", "=_", "None_", ",_", "dictionary_", "=_", "None_", ",_", "k_", "=_", "0.8_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Model", " ", "construct", "or", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "model", "\\u", "param", ":", " ", "model", " ", "parameter", "s", ",", " ", "type", ":", " ", "Param", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "dictionar", "y", ":", " ", "type", ":", " ", "Model", "Dict", "ionar", "y", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "k", ":", " ", "Amo", "unt", " ", "of", " ", "variab", "ilit", "y", " ", "to", " ", "keep", " ", "in", " ", "the", " ", "PCA", " ", "reduce", "d", " ", "space", ",", " ", "type", ":", " ", "float", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "model", "\\u", "param_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "dictionary_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "param_", "=_", "dictionary_", "._", "param_", "\\u\\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_", "._", "param_", "=_", "Param_", "(_", ")_", "\\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_", "._", "param_", "=_", "model", "\\u", "param_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "dictionary_", "=_", "dictionary_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "\"", "The", " ", "shape", " ", "of", " ", "the", " ", "dictionar", "y", " ", "used", " ", "for", " ", "the", " ", "PCA", " ", "is", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"(\"_", "+_", "str_", "(_", "self_", "._", "dictionary_", "._", "N_", ")_", "+_", "\",\"_", "+_", "str_", "(_", "self_", "._", "dictionary_", "._", "J_", ")_", "+_", "\")\"_", ",_", "verbose_", "=_", "self_", "._", "param_", "._", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Instantiate", " ", "a", " ", "PCA", " ", "object", " ", "give", "n", " ", "the", " ", "dictionar", "y", " ", "just", " ", "build_", "\\u\\u\\uNL\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Creat", "ing", " ", "a", " ", "reduce", "d", " ", "common", " ", "space", " ", "(", "usi", "ng", " ", "a", " ", "PCA", ")", " ", "...'_", ",_", "self_", "._", "param_", "._", "verbose_", ",_", "'", "normal", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "param_", "._", "todo", "\\u", "model_", "==_", "'", "compute", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "creati", "on", " ", "of", " ", "a", " ", "PCA", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "pca_", "=_", "PCA", "_", "(_", "np_", "._", "asarray_", "(_", "self_", "._", "dictionary_", "._", "slices_", ")_", ",_", "k_", "=_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "updat", "ing", " ", "the", " ", "dictionar", "y", " ", "mean", "\\u", "image", " _", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "dictionary_", "._", "mean", "\\u", "image_", "=_", "self_", "._", "pca_", "._", "mean", "\\u", "image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "save", "\\u", "image_", "(_", "self_", "._", "pca_", "._", "mean", "\\u", "image_", ",_", "'", "mean", "\\u", "image", "'_", ",_", "path_", "=_", "self_", "._", "dictionary_", "._", "model", "\\u", "dic", "\\u", "name_", "+_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "saving", " ", "the", " ", "PCA", " ", "data", " ", "int", "o", " ", "a", " ", "text", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "pca_", "._", "save", "\\u", "data_", "(_", "self_", "._", "dictionary_", "._", "model", "\\u", "dic", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "param_", "._", "todo", "\\u", "model_", "==_", "'", "load", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "load", "ing", " ", "PCA", " ", "data", " ", "from", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pca", "\\u", "mean", "\\u", "data_", ",_", "pca", "\\u", "eig", "\\u", "pairs_", "=_", "self_", "._", "load", "\\u", "pca", "\\u", "file_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "creati", "on", " ", "of", " ", "a", " ", "PCA", " ", "from", " ", "the", " ", "load", "ed", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "pca_", "=_", "PCA", "_", "(_", "np_", "._", "asarray_", "(_", "self_", "._", "dictionary_", "._", "slices_", ")_", ",_", "mean", "\\u", "vect_", "=_", "pca", "\\u", "mean", "\\u", "data_", ",_", "eig", "\\u", "pairs_", "=_", "pca", "\\u", "eig", "\\u", "pairs_", ",_", "k_", "=_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "param_", "._", "verbose_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "pca_", "._", "plot", "\\u", "projected", "\\u", "dic_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load", "\\u", "pca", "\\u", "file_", "(_", "self_", ",_", "file", "\\u", "name_", "=_", "'", "data\\u", "pca", ".", "txt", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Load", " ", "a", " ", "PCA", " ", "from", " ", "a", " ", "text", " ", "file", " ", "contain", "ing", " ", "the", " ", "appropr", "iate", " ", "informati", "on", " ", "(", "previ", "ously", " ", "saved", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "file", "\\u", "name", ":", " ", "name", " ", "of", " ", "the", " ", "PCA", " ", "text", " ", "file", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fic", "\\u", "data\\u", "pca_", "=_", "open_", "(_", "self_", "._", "param_", "._", "path", "\\u", "dictionary_", "+_", "'/'_", "+_", "file", "\\u", "name_", ",_", "'", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mean", "\\u", "data\\u", "list_", "=_", "fic", "\\u", "data\\u", "pca_", "._", "readline_", "(_", ")_", "._", "split_", "(_", "','_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eig", "\\u", "pair", "s", "\\u", "list_", "=_", "fic", "\\u", "data\\u", "pca_", "._", "readline_", "(_", ")_", "._", "split_", "(_", "','_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fic", "\\u", "data\\u", "pca_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mean", "\\u", "data\\u", "vect_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "val_", "in_", "mean", "\\u", "data\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mean", "\\u", "data\\u", "vect_", "._", "append_", "(_", "[_", "float_", "(_", "val_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mean", "\\u", "data\\u", "vect_", "=_", "np_", "._", "asarray_", "(_", "mean", "\\u", "data\\u", "vect_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "eig", "\\u", "pair", "s", "\\u", "vect_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "pair_", "in_", "eig", "\\u", "pair", "s", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eig", "\\u", "val", "\\u", "str_", ",_", "eig", "\\u", "vect", "\\u", "str_", "=_", "pair_", "._", "split_", "(_", "';'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eig", "\\u", "vect", "\\u", "str_", "=_", "eig", "\\u", "vect", "\\u", "str_", "._", "split_", "(_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "eig", "\\u", "vect", "\\u", "str", "[-", "1", "]", " ", "=", " ", "eig", "\\u", "vect", "\\u", "str", "[-", "1", "][", ":-", "1", "]_", "\\u\\u\\uNL\\u\\u\\u_", "eig", "\\u", "vect_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "v_", "in_", "enumerate_", "(_", "eig", "\\u", "vect", "\\u", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "v_", "!=_", "''_", "and_", "v_", "!=_", "'\\\\", "n", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "eig", "\\u", "vect_", "._", "append_", "(_", "float_", "(_", "v_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "eig", "\\u", "pair", "s", "\\u", "vect_", "._", "append_", "(_", "(_", "float_", "(_", "eig", "\\u", "val", "\\u", "str_", ")_", ",_", "eig", "\\u", "vect_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "mean", "\\u", "data\\u", "vect_", ",_", "eig", "\\u", "pair", "s", "\\u", "vect_", "\\u\\u\\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_", "Target", "Segmentation", "Pair", "wise_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Contain", "s", " ", "all", " ", "the", " ", "function", " ", "to", " ", "segment", " ", "the", " ", "gray", " ", "matte", "r", " ", "an", " ", "a", " ", "target", " ", "image", " ", "give", "n", " ", "a", " ", "model", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "registration", " ", "of", " ", "the", " ", "target", " ", "to", " ", "the", " ", "model", " ", "space", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "projecti", "on", " ", "of", " ", "the", " ", "target", " ", "slice", "s", " ", "on", " ", "the", " ", "reduce", "d", " ", "model", " ", "space", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "selection", " ", "of", " ", "the", " ", "model", " ", "slice", "s", " ", "most", " ", "similar", " ", "to", " ", "the", " ", "target", " ", "slice", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "computation", " ", "of", " ", "the", " ", "result", "ing", " ", "target", " ", "segmentation", " ", "by", " ", "label", " ", "fusion", " ", "of", " ", "thei", "r", " ", "segmentation", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "'''", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "select", "\\u", "k", "\\u", "slice", "s", "\\u", "old", "(", "self", ",", " ", "beta", ",", " ", "pop", "ed", "=", "Non", "e", "):", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Select", " ", "the", " ", "K", " ", "dictionar", "y", " ", "slice", "s", " ", "most", " ", "similar", " ", "to", " ", "the", " ", "target", " ", "slice", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "beta", ":", " ", "Dict", "ionar", "y", " ", "similar", "iti", "es", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", " ", "selecte", "d", ":", " ", "nump", "y", " ", "array", " ", "of", " ", "index", " ", "of", " ", "the", " ", "selecte", "d", " ", "dictionar", "y", " ", "slice", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "selecte", "d", " ", "=", " ", "[]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "slice", "s", "\\u", "index", " ", "=", " ", "range", "(", "self", ".", "model", ".", "dictionar", "y", ".", "J", ")", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "pop", "ed", " ", "is", " ", "not", " ", "Non", "e", ":", "\\", "10", ";", " ", " ", " ", " ", "slice", "s", "\\u", "index", ".", "pop", "(", "pop", "ed", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "isin", "stance", "(", "beta", "[", "0", "],", " ", "(", "list", ",", " ", "np", ".", "ndar", "ray", "))", ":", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "beta", "\\u", "slice", " ", "in", " ", "beta", ":", "\\", "10", ";", " ", " ", " ", " ", "selecte", "d\\u", "by", "\\u", "slice", " ", "=", " ", "[]", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "j", ",", " ", "beta", "\\u", "j", " ", "in", " ", "zip", "(", "slice", "s", "\\u", "index", ",", " ", "beta", "\\u", "slice", "):", "\\", "10", ";", " ", " ", "if", " ", "beta", "\\u", "j", " ", ">", " ", "self", ".", "eps", "ilon", ":", "\\", "10", ";", " ", " ", "selecte", "d\\u", "by", "\\u", "slice", ".", "append", "(", "j", ")", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "selecte", "d", ".", "append", "(", "np", ".", "asa", "rray", "(", "selecte", "d\\u", "by", "\\u", "slice", "))\\", "10", ";", " ", " ", " ", " ", "selecte", "d", ".", "append", "(", "selecte", "d\\u", "by", "\\u", "slice", ")", "\\", "10", ";", " ", " ", " ", " ", "else", ":", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "j", ",", " ", "beta", "\\u", "j", " ", "in", " ", "zip", "(", "slice", "s", "\\u", "index", ",", " ", "beta", "):", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "beta", "\\u", "j", " ", ">", " ", "self", ".", "eps", "ilon", ":", "\\", "10", ";", " ", " ", "selecte", "d", ".", "append", "(", "j", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "np", ".", "asa", "rray", "(", "selecte", "d", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "label", "\\u", "fusion", "\\u", "old", "(", "self", ",", " ", "selecte", "d\\u", "slice", "s", "):", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Compute", " ", "the", " ", "result", "ing", " ", "segmentation", " ", "by", " ", "label", " ", "fusion", " ", "of", " ", "the", " ", "segmentation", " ", "of", " ", "the", " ", "selecte", "d", " ", "dictionar", "y", " ", "slice", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "selecte", "d\\u", "slice", "s", ":", " ", "array", " ", "of", " ", "indexe", "s", " ", "of", " ", "the", " ", "selecte", "d", " ", "dictionar", "y", " ", "slice", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", " ", "res", "\\u", "seg", "\\u", "model", "\\u", "space", ":", " ", "Image", " ", "of", " ", "the", " ", "result", "ing", " ", "segmentation", " ", "for", " ", "the", " ", "target", " ", "image", " ", "(", "in", " ", "the", " ", "model", " ", "space", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "res", "\\u", "seg", "\\u", "model", "\\u", "space", " ", "=", " ", "[]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "isin", "stance", "(", "selecte", "d\\u", "slice", "s", "[", "0", "],", " ", "(", "list", ",", " ", "np", ".", "ndar", "ray", "))", ":", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "i", "\\u", "target", ",", " ", "selecte", "d\\u", "by", "\\u", "slice", " ", "in", " ", "enumerate", "(", "selecte", "d\\u", "slice", "s", "):", "\\", "10", ";", " ", " ", " ", " ", "kep", "t", "\\u", "slice", "s", "\\u", "segmentation", " ", "=", " ", "[]", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "j", " ", "in", " ", "selecte", "d\\u", "by", "\\u", "slice", ":", "\\", "10", ";", " ", " ", "kep", "t", "\\u", "slice", "s", "\\u", "segmentation", ".", "append", "(", "self", ".", "model", ".", "dictionar", "y", ".", "slice", "s", "[", "j", "].", "seg", "\\u", "M", ")", "\\", "10", ";", " ", " ", " ", " ", "slice", "\\u", "seg", " ", "=", " ", "compute", "\\u", "major", "it", "y", "\\u", "vote", "\\u", "mean", "\\u", "seg", "(", "kep", "t", "\\u", "slice", "s", "\\u", "segmentation", ")", "\\", "10", ";", " ", " ", " ", " ", "res", "\\u", "seg", "\\u", "model", "\\u", "space", ".", "append", "(", "slice", "\\u", "seg", ")", "\\", "10", ";", " ", " ", " ", " ", "else", ":", "\\", "10", ";", " ", " ", " ", " ", "kep", "t", "\\u", "slice", "s", "\\u", "segmentation", " ", "=", " ", "[]", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "j", " ", "in", " ", "selecte", "d\\u", "slice", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "kep", "t", "\\u", "slice", "s", "\\u", "segmentation", ".", "append", "(", "self", ".", "model", ".", "dictionar", "y", ".", "slice", "s", "[", "j", "].", "seg", "\\u", "M", ")", "\\", "10", ";", " ", " ", " ", " ", "slice", "\\u", "seg", " ", "=", " ", "compute", "\\u", "major", "it", "y", "\\u", "vote", "\\u", "mean", "\\u", "seg", "(", "kep", "t", "\\u", "slice", "s", "\\u", "segmentation", ")", "\\", "10", ";", " ", " ", " ", " ", "res", "\\u", "seg", "\\u", "model", "\\u", "space", " ", "=", " ", "slice", "\\u", "seg", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "res", "\\u", "seg", "\\u", "model", "\\u", "space", " ", "=", " ", "np", ".", "asa", "rray", "(", "res", "\\u", "seg", "\\u", "model", "\\u", "space", ")", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "save", "\\u", "image", "(", "res", "\\u", "seg", "\\u", "model", "\\u", "space", ",", " ", "'", "res", "\\u", "GM", "\\u", "seg", "\\u", "model", "\\u", "space", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "Image", "(", "res", "\\u", "seg", "\\u", "model", "\\u", "space", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\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\\uDEDENT\\u\\u\\u_", "'''", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "major", "it", "y", "\\u", "vote", "\\u", "segmentation", "(", "self", "):", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Mea", "n", " ", "segmentation", " ", "usi", "ng", " ", "only", " ", "the", " ", "slice", "s", " ", "of", " ", "the", " ", "same", " ", "level", " ", "in", " ", "the", " ", "dictionar", "y", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "target", "\\u", "seg", " ", "=", " ", "[]", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "target", "\\u", "slice", " ", "in", " ", "self", ".", "target", ":", "\\", "10", ";", " ", " ", " ", " ", "dataset", "\\u", "by", "\\u", "level", " ", "=", " ", "[]", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "dic", "\\u", "slice", " ", "in", " ", "self", ".", "model", ".", "dictionar", "y", ".", "slice", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "dic", "\\u", "slice", ".", "level", " ", "==", " ", "target", "\\u", "slice", ".", "level", ":", "\\", "10", ";", " ", " ", "dataset", "\\u", "by", "\\u", "level", ".", "append", "(", "dic", "\\u", "slice", ".", "seg", "\\u", "M", ")", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "dataset", "\\u", "by", "\\u", "level", ":", "\\", "10", ";", " ", " ", " ", " ", "target", "\\u", "slice", "\\u", "seg", " ", "=", " ", "compute", "\\u", "major", "it", "y", "\\u", "vote", "\\u", "mean", "\\u", "seg", "(", "dataset", "\\u", "by", "\\u", "level", ",", " ", "threshol", "d", "=", "0.", "5", ")", "\\", "10", ";", " ", " ", " ", " ", "Image", "(", "param", "=", "target", "\\u", "slice", "\\u", "seg", ",", " ", "abs", "olute", "path", "='", "target", "\\u", "gm", "\\u", "seg", "\\u", "slice", "'", " ", "+", " ", "str", "(", "target", "\\u", "slice", ".", "id", ")", " ", "+", " ", "'.", "ni", "i", ".", "gz", "')", ".", "save", "()", "\\", "10", ";", " ", " ", " ", " ", "target", "\\u", "seg", ".", "append", "(", "target", "\\u", "slice", "\\u", "seg", ")", "\\", "10", ";", " ", " ", " ", " ", "else", ":", "\\", "10", ";", " ", " ", " ", " ", "target", "\\u", "seg", ".", "append", "(", "np", ".", "zero", "s", "(", "target", "\\u", "slice", ".", "im", ".", "shape", "))\\", "10", ";", " ", " ", " ", " ", "Image", "(", "param", "=", "np", ".", "asa", "rray", "(", "target", "\\u", "seg", "),", " ", "abs", "olute", "path", "='", "target", "\\u", "gm", "\\u", "seg", ".", "ni", "i", ".", "gz", "')", ".", "save", "()", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "show", "\\u", "projected", "\\u", "target", "(", "self", "):", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "Retriev", "ing", " ", "projected", " ", "image", " ", "from", " ", "the", " ", "mean", " ", "image", " ", "&", " ", "its", " ", "coordinate", "s", "\\", "10", ";", " ", " ", " ", " ", "import", " ", "copy", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "index", " ", "=", " ", "0", "\\", "10", ";", " ", " ", " ", " ", "fig", "1", " ", "=", " ", "plt", ".", "figure", "()", "\\", "10", ";", " ", " ", " ", " ", "fig", "2", " ", "=", " ", "plt", ".", "figure", "()", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "loop", " ", "acro", "ss", " ", "all", " ", "the", " ", "projected", " ", "slice", "s", " ", "coord", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "coord", " ", "in", " ", "self", ".", "coord", "\\u", "projected", "\\u", "target", ":", "\\", "10", ";", " ", " ", " ", " ", "img", "\\u", "reduc", "ted", " ", "=", " ", "copy", ".", "copy", "(", "self", ".", "model", ".", "pca", ".", "mean", "\\u", "data\\u", "vect", ")", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "loop", " ", "acro", "ss", " ", "coord", " ", "and", " ", "build", " ", "projected", " ", "image", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "i", " ", "in", " ", "range", "(", "0", ",", " ", "coord", ".", "shape", "[", "0", "])", ":", "\\", "10", ";", " ", " ", " ", " ", "img", "\\u", "reduc", "ted", " ", "+=", " ", "int", "(", "coord", "[", "i", "][", "0", "])", " ", "*", " ", "self", ".", "model", ".", "pca", ".", "kep", "t", "\\u", "mode", "s", ".", "T", "[", "i", "].", "reshape", "(", "self", ".", "model", ".", "pca", ".", "N", ",", " ", "1", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "self", ".", "model", ".", "param", ".", "split", "\\u", "data", ":", "\\", "10", ";", " ", " ", " ", " ", "n", " ", "=", " ", "int", "(", "sqrt", "(", "self", ".", "model", ".", "pca", ".", "N", " ", "*", " ", "2", "))\\", "10", ";", " ", " ", " ", " ", "else", ":", "\\", "10", ";", " ", " ", " ", " ", "n", " ", "=", " ", "int", "(", "sqrt", "(", "self", ".", "model", ".", "pca", ".", "N", "))\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "Plot", " ", "original", " ", "image", "\\", "10", ";", " ", " ", " ", " ", "orig", "\\u", "ax", " ", "=", " ", "fig", "1", ".", "add", "\\u", "subplot", "(", "10", ",", " ", "3", ",", " ", "index", ")", "\\", "10", ";", " ", " ", " ", " ", "orig", "\\u", "ax", ".", "set\\u", "title", "('", "original", " ", "slice", " ", "{}", " ", "'.", "format", "(", "index", "))\\", "10", ";", " ", " ", " ", " ", "if", " ", "self", ".", "model", ".", "param", ".", "split", "\\u", "data", ":", "\\", "10", ";", " ", " ", " ", " ", "img", "plot", " ", "=", " ", "orig", "\\u", "ax", ".", "ims", "how", "(", "self", ".", "target", ".", "data", "[", "index", ",", " ", ":,", " ", ":]", ".", "reshape", "(", "n", " ", "/", " ", "2", ",", " ", "n", "))\\", "10", ";", " ", " ", " ", " ", "else", ":", "\\", "10", ";", " ", " ", " ", " ", "img", "plot", " ", "=", " ", "orig", "\\u", "ax", ".", "ims", "how", "(", "self", ".", "target", ".", "data", "[", "index", "].", "reshape", "(", "n", ",", " ", "n", "))\\", "10", ";", " ", " ", " ", " ", "img", "plot", ".", "set\\u", "interpolati", "on", "('", "near", "est", "')", "\\", "10", ";", " ", " ", " ", " ", "img", "plot", ".", "set\\u", "cmap", "('", "gray", "')", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "plt", ".", "title", "('", "Origina", "l", " ", "Image", "')", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "plt", ".", "show", "()", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "index", " ", "+=", " ", "1", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "Plot", " ", "projected", " ", "image", " ", "image", "\\", "10", ";", " ", " ", " ", " ", "proj", "\\u", "ax", " ", "=", " ", "fig", "2", ".", "add", "\\u", "subplot", "(", "10", ",", " ", "3", ",", " ", "index", ")", "\\", "10", ";", " ", " ", " ", " ", "proj", "\\u", "ax", ".", "set\\u", "title", "('", "slice", " ", "{}", " ", "projected", "'.", "format", "(", "index", "))\\", "10", ";", " ", " ", " ", " ", "if", " ", "self", ".", "model", ".", "param", ".", "split", "\\u", "data", ":", "\\", "10", ";", " ", " ", " ", " ", "img", "plot", " ", "=", " ", "proj", "\\u", "ax", ".", "ims", "how", "(", "img", "\\u", "reduc", "ted", ".", "reshape", "(", "n", " ", "/", " ", "2", ",", " ", "n", "))\\", "10", ";", " ", " ", " ", " ", "#", "img", "plot", " ", "=", " ", "plt", ".", "ims", "how", "(", "img", "\\u", "reduc", "ted", ".", "reshape", "(", "n", " ", "/", " ", "2", ",", " ", "n", "))\\", "10", ";", " ", " ", " ", " ", "else", ":", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "img", "plot", " ", "=", " ", "plt", ".", "ims", "how", "(", "img", "\\u", "reduc", "ted", ".", "reshape", "(", "n", ",", " ", "n", "))\\", "10", ";", " ", " ", " ", " ", "img", "plot", " ", "=", " ", "proj", "\\u", "ax", ".", "ims", "how", "(", "img", "\\u", "reduc", "ted", ".", "reshape", "(", "n", ",", " ", "n", "))\\", "10", ";", " ", " ", " ", " ", "img", "plot", ".", "set\\u", "interpolati", "on", "('", "near", "est", "')", "\\", "10", ";", " ", " ", " ", " ", "img", "plot", ".", "set\\u", "cmap", "('", "gray", "')", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "plt", ".", "title", "('", "Project", "ed", " ", "Image", "')", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "plt", ".", "show", "()", "\\", "10", ";", " ", " ", " ", " ", "plt", ".", "show", "()", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Target", "Segmentation", "Pair", "wise_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "model_", ",_", "target", "\\u", "image_", "=_", "None_", ",_", "level", "s", "\\u", "image_", "=_", "None_", ",_", "tau_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Target", " ", "gray", " ", "matte", "r", " ", "segmentation", " ", "construct", "or", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "model", ":", " ", "Model", " ", "used", " ", "to", " ", "compute", " ", "the", " ", "segmentation", ",", " ", "type", ":", " ", "Model", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "target", "\\u", "image", ":", " ", "Target", " ", "image", " ", "to", " ", "segment", " ", "gray", " ", "matte", "r", " ", "on", ",", " ", "type", ":", " ", "Image", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "tau", ":", " ", "Weig", "hti", "ng", " ", "parameter", " ", "associate", "d", " ", "with", " ", "the", " ", "geod", "esi", "c", " ", "distance", "s", " ", "in", " ", "the", " ", "model", " ", "dictionar", "y", ",", " ", "type", ":", " ", "float", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "model_", "=_", "model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "target", " ", "image_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "target", "\\u", "image_", "._", "data_", "._", "shape_", ")_", "==_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "target_", "=_", "[_", "Slice_", "(_", "slice", "\\u", "id_", "=_", "i", "\\u", "slice_", ",_", "im_", "=_", "target", "\\u", "slice_", ")_", "for_", "i", "\\u", "slice_", ",_", "target", "\\u", "slice_", "in_", "enumerate_", "(_", "target", "\\u", "image_", "._", "data_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "target", "\\u", "image_", "._", "data_", "._", "shape_", ")_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "target_", "=_", "[_", "Slice_", "(_", "slice", "\\u", "id_", "=_", "0_", ",_", "im_", "=_", "target", "\\u", "image_", "._", "data_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "level", "s", "\\u", "image", " ", "is", " ", "not", " ", "Non", "e", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "level", "s", "\\u", "image_", ",_", "Image_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nz", "\\u", "coord_", "=_", "level", "s", "\\u", "image_", "._", "get", "Non", "Zero", "Coordinates_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i", "\\u", "level", "\\u", "slice_", ",_", "level", "\\u", "slice_", "in_", "enumerate_", "(_", "level", "s", "\\u", "image_", "._", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nz", "\\u", "val_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "coord_", "in_", "nz", "\\u", "coord_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "coord_", "._", "x_", "==_", "i", "\\u", "level", "\\u", "slice_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "nz", "\\u", "val_", "._", "append_", "(_", "level", "\\u", "slice_", "[_", "coord_", "._", "y_", ",_", "coord_", "._", "z_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "target_", "[_", "i", "\\u", "level", "\\u", "slice_", "]_", "._", "set_", "(_", "level_", "=_", "int_", "(_", "round_", "(_", "sum_", "(_", "nz", "\\u", "val_", ")_", "/_", "len_", "(_", "nz", "\\u", "val_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Zero", "Divis", "ion", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "sct", "_", "._", "print", "v_", "(_", "'", "No", " ", "level", " ", "label", " ", "for", " ", "slice", " ", "'_", "+_", "str_", "(_", "i", "\\u", "level", "\\u", "slice_", ")_", "+_", "'", " ", "of", " ", "target", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "target_", "[_", "i", "\\u", "level", "\\u", "slice_", "]_", "._", "set_", "(_", "level_", "=_", "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_", "elif_", "isinstance_", "(_", "level", "s", "\\u", "image_", ",_", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "target_", "[_", "0_", "]_", "._", "set_", "(_", "level_", "=_", "get", "\\u", "key", "\\u", "from", "\\u", "val_", "(_", "self_", "._", "model_", "._", "dictionary_", "._", "level", "\\u", "label_", ",_", "level", "s", "\\u", "image_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", ".", "major", "it", "y", "\\u", "vote", "\\u", "segmentation", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", ".", "target", "\\u", "M", " ", "=", " ", "self", ".", "target", "\\u", "pairwise", "\\u", "registration", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "target", "\\u", "pairwise", "\\u", "registration_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "coord", "\\u", "projected", "\\u", "target", " ", "is", " ", "a", " ", "list", " ", "of", " ", "all", " ", "the", " ", "coord", " ", "of", " ", "the", " ", "target", "'", "s", " ", "projected", " ", "slices_", "\\u\\u\\uNL\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Project", "ing", " ", "the", " ", "target", " ", "image", " ", "in", " ", "the", " ", "reduce", "d", " ", "common", " ", "space", " ", "...'_", ",_", "model_", "._", "param_", "._", "verbose_", ",_", "'", "normal", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "self", ".", "coord", "\\u", "projected", "\\u", "target", " ", "=", " ", "model", ".", "pca", ".", "project", "(", "self", ".", "target", "\\u", "M", ")", " ", "if", " ", "self", ".", "target", "\\u", "M", " ", "is", " ", "not", " ", "Non", "e", " ", "else", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "coord", "\\u", "projected", "\\u", "target_", "=_", "model_", "._", "pca_", "._", "project_", "(_", "[_", "target", "\\u", "slice_", "._", "im", "\\u", "M_", "for_", "target", "\\u", "slice_", "in_", "self_", "._", "target_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "epsilon_", "=_", "round_", "(_", "1.0_", "/_", "self_", "._", "model_", "._", "dictionary_", "._", "J_", ",_", "4_", ")_", "/_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "eps", "ilon", " ", ":", " ", "'_", ",_", "self_", "._", "epsilon_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "tau_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "tau_", "=_", "self_", "._", "compute", "\\u", "tau_", "(_", ")_", "\\u\\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_", "._", "tau_", "=_", "tau_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "level", "s", "\\u", "image_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "beta_", "=_", "self_", "._", "compute", "\\u", "beta_", "(_", "self_", "._", "coord", "\\u", "projected", "\\u", "target_", ",_", "target", "\\u", "levels_", "=_", "np_", "._", "asarray_", "(_", "[_", "target", "\\u", "slice_", "._", "level_", "for_", "target", "\\u", "slice_", "in_", "self_", "._", "target_", "]_", ")_", ",_", "tau_", "=_", "self_", "._", "tau_", ")_", "\\u\\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_", "._", "beta_", "=_", "self_", "._", "compute", "\\u", "beta_", "(_", "self_", "._", "coord", "\\u", "projected", "\\u", "target_", ",_", "tau_", "=_", "self_", "._", "tau_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Selecti", "ng", " ", "the", " ", "dictionar", "y", " ", "slice", "s", " ", "most", " ", "similar", " ", "to", " ", "the", " ", "target", " ", "...'_", ",_", "model_", "._", "param_", "._", "verbose_", ",_", "'", "normal", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "selecte", "d\\u", "k", "\\u", "slices_", "=_", "self_", "._", "select", "\\u", "k", "\\u", "slices_", "(_", "self_", "._", "beta_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "slice", "\\u", "levels_", "=_", "np_", "._", "asarray_", "(_", "[_", "self_", "._", "model_", "._", "dictionary_", "._", "level", "\\u", "label_", "[_", "dic", "\\u", "slice_", "._", "level_", "]_", "for_", "dic", "\\u", "slice_", "in_", "self_", "._", "model_", "._", "dictionary_", "._", "slices_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fic", "\\u", "selecte", "d\\u", "slices_", "=_", "open_", "(_", "'", "selecte", "d\\u", "slice", "s", ".", "txt", "'_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fic", "\\u", "selecte", "d\\u", "slices_", "._", "write_", "(_", "str_", "(_", "slice", "\\u", "levels_", "[_", "self_", "._", "selecte", "d\\u", "k", "\\u", "slices_", "._", "reshape_", "(_", "self_", "._", "model_", "._", "dictionary_", "._", "J_", ",_", ")_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fic", "\\u", "selecte", "d\\u", "slices_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Comp", "uti", "ng", " ", "the", " ", "result", " ", "gray", " ", "matte", "r", " ", "segmentation", " ", "...'_", ",_", "model_", "._", "param_", "._", "verbose_", ",_", "'", "normal", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "self", ".", "target", "\\u", "GM", "\\u", "seg", "\\u", "M", " ", "=", " ", "self", ".", "label", "\\u", "fusion", "(", "self", ".", "selecte", "d\\u", "k", "\\u", "slice", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "label", "\\u", "fusion", "_", "(_", "self_", "._", "selecte", "d\\u", "k", "\\u", "slices_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Register", "ing", " ", "the", " ", "result", " ", "gray", " ", "matte", "r", " ", "segmentation", " ", "back", " ", "int", "o", " ", "the", " ", "target", " ", "original", " ", "space", "...'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model_", "._", "param_", "._", "verbose_", ",_", "'", "normal", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "target", "\\u", "pairwise", "\\u", "registration_", "(_", "inverse_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Target", "Segmentation", "Pair", "wise_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "target", "\\u", "pairwise", "\\u", "registration_", "(_", "self_", ",_", "inverse_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Register", " ", "the", " ", "target", " ", "image", " ", "int", "o", " ", "the", " ", "model", " ", "space", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Affi", "ne", " ", "(", "or", " ", "rigid", " ", "+", " ", "affin", "e", ")", " ", "registration", " ", "of", " ", "the", " ", "target", " ", "on", " ", "the", " ", "mean", " ", "model", " ", "image", " ", "-->", " ", "pairwise", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "inv", "erse", ":", " ", "if", " ", "Tru", "e", ",", " ", "appl", "y", " ", "the", " ", "inv", "erse", " ", "warp", "ing", " ", "field", " ", "of", " ", "the", " ", "registration", " ", "target", " ", "->", " ", "model", " ", "space", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "the", " ", "result", " ", "gray", " ", "matte", "r", " ", "segmentation", " ", "of", " ", "the", " ", "target", "\\", "10", ";", " ", " ", " ", " ", "(", "put", " ", "it", " ", "back", " ", "in", " ", "it", "'", "s", " ", "original", " ", "space", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "inverse_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Registration", " ", "target", " ", "-->", " ", "model", " ", "space_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target", "\\u", "model", "\\u", "space_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mean", "\\u", "dic", "\\u", "im_", "=_", "self_", "._", "model_", "._", "pca_", "._", "mean", "\\u", "image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "target", "\\u", "slice_", "in_", "enumerate_", "(_", "self_", "._", "target_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "movin", "g", "\\u", "target", "\\u", "slice_", "=_", "target", "\\u", "slice_", "._", "im_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "transf", "o_", "in_", "self_", "._", "model_", "._", "dictionary_", "._", "core", "gist", "ration", "\\u", "transf", "os_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "transf", "o", "\\u", "name_", "=_", "transf", "o_", "+_", "'\\u", "transf", "o", "\\u", "target", "2m", "odel", "\\u", "space", "\\u", "slice", "\\u'_", "+_", "str_", "(_", "i_", ")_", "+_", "find", "\\u", "ant", "s", "\\u", "transf", "o", "\\u", "name_", "(_", "transf", "o_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "movin", "g", "\\u", "target", "\\u", "slice_", "=_", "appl", "y", "\\u", "ant", "s", "\\u", "transf", "o_", "(_", "mean", "\\u", "dic", "\\u", "im_", ",_", "movin", "g", "\\u", "target", "\\u", "slice_", ",_", "binary_", "=_", "False_", ",_", "transf", "o", "\\u", "type_", "=_", "transf", "o_", ",_", "transf", "o", "\\u", "name_", "=_", "transf", "o", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "target_", "[_", "i_", "]_", "._", "set_", "(_", "im", "\\u", "m_", "=_", "movin", "g", "\\u", "target", "\\u", "slice_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "target", "\\u", "model", "\\u", "space", ".", "append", "(", "movin", "g", "\\u", "target", "\\u", "slice", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "return", " ", "Image", "(", "param", "=", "np", ".", "asa", "rray", "(", "target", "\\u", "model", "\\u", "space", "))", "_", "\\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_", "#", " ", "Inv", "erse", " ", "registration", " ", "result", " ", "in", " ", "model", " ", "space", " ", "-->", " ", "target", " ", "original", " ", "space_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res", "\\u", "seg_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "mean", "\\u", "dic", "\\u", "im", " ", "=", " ", "self", ".", "model", ".", "pca", ".", "mean", "\\u", "image_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "i", ",", " ", "slice", "\\u", "M", " ", "in", " ", "enumerate", "(", "self", ".", "target", "\\u", "GM", "\\u", "seg", "\\u", "M", ".", "data", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", ",_", "target", "\\u", "slice_", "in_", "enumerate_", "(_", "self_", "._", "target_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "model_", "._", "param_", "._", "seg", "\\u", "type_", "==_", "'", "wm", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "movin", "g", "\\u", "seg", "\\u", "slice_", "=_", "target", "\\u", "slice_", "._", "wm", "\\u", "seg", "\\u", "M_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "movin", "g", "\\u", "seg", "\\u", "slice_", "=_", "target", "\\u", "slice_", "._", "gm", "\\u", "seg", "\\u", "M_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "transf", "o_", "in_", "self_", "._", "model_", "._", "dictionary_", "._", "core", "gist", "ration", "\\u", "transf", "os_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "transf", "o", "\\u", "name_", "=_", "transf", "o_", "+_", "'\\u", "transf", "o", "\\u", "target", "2m", "odel", "\\u", "space", "\\u", "slice", "\\u'_", "+_", "str_", "(_", "i_", ")_", "+_", "find", "\\u", "ant", "s", "\\u", "transf", "o", "\\u", "name_", "(_", "transf", "o_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "movin", "g", "\\u", "seg", "\\u", "slice_", "=_", "appl", "y", "\\u", "ant", "s", "\\u", "transf", "o_", "(_", "self_", "._", "model_", "._", "dictionary_", "._", "mean", "\\u", "seg_", ",_", "movin", "g", "\\u", "seg", "\\u", "slice_", ",_", "search", "\\u", "reg_", "=_", "False_", ",_", "binary_", "=_", "True_", ",_", "inverse_", "=_", "1_", ",_", "transf", "o", "\\u", "type_", "=_", "transf", "o_", ",_", "transf", "o", "\\u", "name_", "=_", "transf", "o", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "model_", "._", "param_", "._", "seg", "\\u", "type_", "==_", "'", "wm", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "target", "\\u", "slice_", "._", "set_", "(_", "wm", "\\u", "seg_", "=_", "movin", "g", "\\u", "seg", "\\u", "slice_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "target", "\\u", "slice_", "._", "set_", "(_", "gm", "\\u", "seg_", "=_", "movin", "g", "\\u", "seg", "\\u", "slice_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "res", "\\u", "seg", ".", "append", "(", "movin", "g", "\\u", "seg", "\\u", "slice", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "return", " ", "Image", "(", "param", "=", "np", ".", "asa", "rray", "(", "res", "\\u", "seg", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Target", "Segmentation", "Pair", "wise_", ":_", "\\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_", "compute", "\\u", "beta_", "(_", "self_", ",_", "coord", "\\u", "target_", ",_", "target", "\\u", "levels_", "=_", "None_", ",_", "dataset", "\\u", "coord_", "=_", "None_", ",_", "dataset", "\\u", "levels_", "=_", "None_", ",_", "tau_", "=_", "0.01_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Compute", " ", "the", " ", "model", " ", "similar", "it", "y", " ", "(", "beta", ")", " ", "bet", "ween", " ", "each", " ", "model", " ", "slice", " ", "and", " ", "each", " ", "target", " ", "image", " ", "slice", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "beta", "\\u", "j", " ", "=", " ", "(", "1", "/", "Z", ")", "exp", "(-", "tau", "*", "square", "\\u", "norm", "(", "target", "\\u", "coordinate", " ", "-", " ", "slice", "\\u", "j", "\\u", "coordinate", "))\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Z", " ", "is", " ", "the", " ", "partit", "ion", " ", "function", " ", "tha", "t", " ", "enforce", "s", " ", "the", " ", "constraint", " ", "tha", "t", " ", "sum", "(", "beta", ")=", "1", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "coord", "\\u", "target", ":", " ", "coordinate", "s", " ", "of", " ", "the", " ", "target", " ", "image", " ", "in", " ", "the", " ", "reduce", "d", " ", "model", " ", "space", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "tau", ":", " ", "weighting", " ", "parameter", " ", "indicati", "ng", " ", "the", " ", "deca", "y", " ", "constant", " ", "associate", "d", " ", "with", " ", "a", " ", "geod", "esi", "c", " ", "distance", "\\", "10", ";", " ", " ", " ", " ", "bet", "ween", " ", "a", " ", "give", "n", " ", "dictionar", "y", " ", "slice", " ", "and", " ", "a", " ", "projected", " ", "target", " ", "image", " ", "slice", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", ":", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dataset", "\\u", "coord_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "in", " ", "the", " ", "dataset", "\\u", "coord", " ", "matrix", ",", " ", "each", " ", "column", " ", "correspond", " ", "to", " ", "the", " ", "projecti", "on", " ", "of", " ", "one", " ", "of", " ", "the", " ", "original", " ", "data", " ", "image", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "transpose", " ", "opera", "tor", " ", ".", "T", " ", "enable", " ", "the", " ", "loop", " ", "to", " ", "iterate", " ", "over", " ", "all", " ", "the", " ", "images", " ", "coord_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dataset", "\\u", "coord_", "=_", "self_", "._", "model_", "._", "pca_", "._", "dataset", "\\u", "coord_", "._", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dataset", "\\u", "levels_", "=_", "[_", "dic", "\\u", "slice_", "._", "level_", "for_", "dic", "\\u", "slice_", "in_", "self_", "._", "model_", "._", "dictionary_", "._", "slices_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "beta_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "SEE", " ", "IF", " ", "WE", " ", "NEED", " ", "TO", " ", "CHECK", " ", "THE", " ", "SECOND", " ", "DIMENSION", " ", "OF", " ", "COORD", " ", "TARGET", " ", "OR", " ", "THE", " ", "FIR", "ST", " ", "..._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "coord", "\\u", "target_", "[_", "0_", "]_", ",_", "(_", "list_", ",_", "np_", "._", "ndarray_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i", "\\u", "target_", ",_", "coord", "\\u", "projected", "\\u", "slice_", "in_", "enumerate_", "(_", "coord", "\\u", "target_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta", "\\u", "slice_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "j", "\\u", "slice_", ",_", "coord", "\\u", "slice", "\\u", "j_", "in_", "enumerate_", "(_", "dataset", "\\u", "coord_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "square", "\\u", "norm_", "=_", "np_", "._", "linalg_", "._", "norm_", "(_", "(_", "coord", "\\u", "projected", "\\u", "slice_", "-_", "coord", "\\u", "slice", "\\u", "j_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "target", "\\u", "levels_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "target", "\\u", "levels_", "[_", "i", "\\u", "target_", "]_", "==_", "dataset", "\\u", "levels_", "[_", "j", "\\u", "slice_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "beta", "\\u", "slice_", "._", "append_", "(_", "exp_", "(_", "tau_", "*_", "square", "\\u", "norm_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "beta", "\\u", "slice_", "._", "append_", "(_", "exp_", "(_", "-_", "tau_", "*_", "square", "\\u", "norm_", ")_", "/_", "1.2_", "*_", "(_", "target", "\\u", "levels_", "[_", "i", "\\u", "target_", "]_", "-_", "dataset", "\\u", "levels_", "[_", "j", "\\u", "slice_", "]_", ")_", ")_", "\\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 ", " ", " _", "beta", "\\u", "slice_", "._", "append_", "(_", "exp_", "(_", "tau_", "*_", "square", "\\u", "norm_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\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 ", " ", "_", "beta", "\\u", "slice_", "/=_", "np_", "._", "sum_", "(_", "beta", "\\u", "slice_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Zero", "Divis", "ion", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sct", "_", "._", "print", "v_", "(_", "'", "WARN", "ING", " ", ":", " ", "similar", "iti", "es", " ", "are", " ", "null", "'_", ",_", "self_", "._", "model_", "._", "param_", "._", "verbose_", ",_", "'", "warn", "ing", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "beta", "\\u", "slice_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "beta_", "._", "append_", "(_", "beta", "\\u", "slice_", ")_", "\\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_", "j", "\\u", "slice_", ",_", "coord", "\\u", "slice", "\\u", "j_", "in_", "enumerate_", "(_", "dataset", "\\u", "coord_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "square", "\\u", "norm_", "=_", "np_", "._", "linalg_", "._", "norm_", "(_", "(_", "coord", "\\u", "target_", "-_", "coord", "\\u", "slice", "\\u", "j_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "target", "\\u", "levels_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "target", "\\u", "levels_", "==_", "dataset", "\\u", "levels_", "[_", "j", "\\u", "slice_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "beta_", "._", "append_", "(_", "exp_", "(_", "tau_", "*_", "square", "\\u", "norm_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "beta_", "._", "append_", "(_", "exp_", "(_", "-_", "tau_", "*_", "square", "\\u", "norm_", ")_", "/_", "1.2_", "*_", "(_", "target", "\\u", "levels_", "-_", "dataset", "\\u", "levels_", "[_", "j", "\\u", "slice_", "]_", ")_", ")_", "\\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 ", " ", "_", "beta_", "._", "append_", "(_", "exp_", "(_", "tau_", "*_", "square", "\\u", "norm_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\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 ", " _", "beta_", "/=_", "np_", "._", "sum_", "(_", "beta_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Zero", "Divis", "ion", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sct", "_", "._", "print", "v_", "(_", "'", "WARN", "ING", " ", ":", " ", "similar", "iti", "es", " ", "are", " ", "null", "'_", ",_", "self_", "._", "model_", "._", "param_", "._", "verbose_", ",_", "'", "warn", "ing", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "beta_", "\\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_", "np_", "._", "asarray_", "(_", "beta_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Target", "Segmentation", "Pair", "wise_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compute", "\\u", "tau_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Compute", " ", "the", " ", "weighting", " ", "parameter", " ", "indicati", "ng", " ", "the", " ", "deca", "y", " ", "constant", " ", "associate", "d", " ", "with", " ", "a", " ", "geod", "esi", "c", " ", "distance", "\\", "10", ";", " ", " ", " ", " ", "bet", "ween", " ", "a", " ", "give", "n", " ", "dictionar", "y", " ", "slice", " ", "and", " ", "a", " ", "projected", " ", "target", " ", "image", " ", "slice", "\\", "10", ";", " ", " ", " ", " ", ":", "return", ":", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Comp", "uti", "ng", " ", "Tau", " ", "...", " ", "\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "Tau", " ", "is", " ", "a", " ", "weighting", " ", "parameter", " ", "indicati", "ng", " ", "the", " ", "deca", "y", " ", "constant", " ", "associate", "d", " ", "with", " ", "a", " ", "geod", "esi", "c", " ", "distance", " ", "bet", "ween", " ", "a", " ", "give", "n", " ", "atlas", " ", "and", " ", "a", " ", "projected", " ", "target", " ", "image", ",", " ", "see", " ", "As", "man", " ", "pape", "r", ",", " ", "eq", " ", "(", "16", "))'_", ",_", "1_", ",_", "'", "normal", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "scipy_", "._", "optimize_", "import_", "minimize_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "to", "\\u", "minimize_", "(_", "tau_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Compute", " ", "the", " ", "sum", " ", "of", " ", "the", " ", "L0", " ", "norm", " ", "bet", "ween", " ", "a", " ", "slice", " ", "segmentation", " ", "and", " ", "the", " ", "result", "ing", " ", "segmentation", " ", "tha", "t", " ", "wou", "ld", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "found", " ", "if", " ", "the", " ", "slice", " ", "was", " ", "a", " ", "target", " ", "image", " ", "for", " ", "a", " ", "give", "n", " ", "tau", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "a", " ", "give", "n", " ", "model", ",", " ", "Tau", " ", "is", " ", "the", " ", "parameter", " ", "tha", "t", " ", "wou", "ld", " ", "minimize", " ", "this", " ", "function", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "tau", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", " ", "sum", "\\u", "norm", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sum", "\\u", "norm_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "dic", "\\u", "slice_", "in_", "self_", "._", "model_", "._", "dictionary_", "._", "slices_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "projected", "\\u", "dic", "\\u", "slice", "\\u", "coord_", "=_", "self_", "._", "model_", "._", "pca_", "._", "project", "\\u", "array_", "(_", "dic", "\\u", "slice_", "._", "im", "\\u", "M", "\\u", "flat_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coord", "\\u", "dic", "\\u", "slice", "\\u", "dataset_", "=_", "np_", "._", "delete_", "(_", "self_", "._", "model_", "._", "pca_", "._", "dataset", "\\u", "coord_", "._", "T_", ",_", "dic", "\\u", "slice_", "._", "id_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dic", "\\u", "slice", "\\u", "dataset", "\\u", "levels_", "=_", "np_", "._", "delete_", "(_", "np_", "._", "asarray_", "(_", "dic", "\\u", "levels_", ")_", ",_", "dic", "\\u", "slice_", "._", "id_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta", "\\u", "dic", "\\u", "slice_", "=_", "self_", "._", "compute", "\\u", "beta_", "(_", "projected", "\\u", "dic", "\\u", "slice", "\\u", "coord_", ",_", "target", "\\u", "levels_", "=_", "dic", "\\u", "slice_", "._", "level_", ",_", "dataset", "\\u", "coord_", "=_", "coord", "\\u", "dic", "\\u", "slice", "\\u", "dataset_", ",_", "dataset", "\\u", "levels_", "=_", "dic", "\\u", "slice", "\\u", "dataset", "\\u", "levels_", ",_", "tau_", "=_", "tau_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kj", "_", "=_", "self_", "._", "select", "\\u", "k", "\\u", "slices_", "(_", "beta", "\\u", "dic", "\\u", "slice_", ")_", "#", " ", ",", " ", "pop", "ed", "=", "dic", "\\u", "slice", ".", "id", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "est", "\\u", "segm", "\\u", "j_", "=_", "self_", "._", "label", "\\u", "fusion", "_", "(_", "kj", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "model_", "._", "param_", "._", "seg", "\\u", "type_", "==_", "'", "wm", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sum", "\\u", "norm_", "+=_", "l", "0", "\\u", "norm_", "(_", "dic", "\\u", "slice_", "._", "wm", "\\u", "seg", "\\u", "M_", ",_", "est", "\\u", "segm", "\\u", "j_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sum", "\\u", "norm_", "+=_", "l", "0", "\\u", "norm_", "(_", "dic", "\\u", "slice_", "._", "gm", "\\u", "seg", "\\u", "M_", ",_", "est", "\\u", "segm", "\\u", "j_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "sum", "\\u", "norm_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dic", "\\u", "levels_", "=_", "[_", "dic", "\\u", "slice_", "._", "level_", "for_", "dic", "\\u", "slice_", "in_", "self_", "._", "model_", "._", "dictionary_", "._", "slices_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "est", "\\u", "tau_", "=_", "minimize_", "(_", "to", "\\u", "minimize_", ",_", "0.001_", ",_", "method_", "=_", "'", "Ne", "lder", "-", "Mea", "d", "'_", ",_", "options_", "=_", "{_", "'", "xt", "ol", "'_", ":_", "0.0005", "_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'", "Estimated", " ", "tau", " ", ":", " ", "'_", "+_", "str_", "(_", "est", "\\u", "tau_", "._", "x_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "model_", "._", "param_", "._", "todo", "\\u", "model_", "==_", "'", "compute", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fic", "_", "=_", "open_", "(_", "self_", "._", "model_", "._", "dictionary_", "._", "model", "\\u", "dic", "\\u", "name_", "+_", "'/", "tau", ".", "txt", "'_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fic", "_", "._", "write_", "(_", "str_", "(_", "est", "\\u", "tau_", "._", "x_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fic", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "float_", "(_", "est", "\\u", "tau_", "._", "x_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Target", "Segmentation", "Pair", "wise_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "select", "\\u", "k", "\\u", "slices_", "(_", "self_", ",_", "beta_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Select", " ", "the", " ", "K", " ", "dictionar", "y", " ", "slice", "s", " ", "most", " ", "similar", " ", "to", " ", "the", " ", "target", " ", "slice", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "beta", ":", " ", "Dict", "ionar", "y", " ", "similar", "iti", "es", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", " ", "selecte", "d", ":", " ", "nump", "y", " ", "array", " ", "of", " ", "segmentation", " ", "of", " ", "the", " ", "selecte", "d", " ", "dictionar", "y", " ", "slice", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "kep", "t", "\\u", "slice", "\\u", "index_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "beta_", "[_", "0_", "]_", ",_", "(_", "list_", ",_", "np_", "._", "ndarray_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "beta", "\\u", "slice_", "in_", "beta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "selecte", "d\\u", "index_", "=_", "beta", "\\u", "slice_", ">_", "self_", "._", "epsilon_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "'''", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "pop", "ed", " ", "is", " ", "not", " ", "Non", "e", ":", "\\", "10", ";", " ", " ", "selecte", "d\\u", "index", " ", "=", " ", "np", ".", "delete", "(", "selecte", "d\\u", "index", ",", " ", "pop", "ed", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "kep", "t", "\\u", "seg", "\\u", "slice", "s", ".", "append", "(", "segmentation", "\\u", "slice", "s", "[", "selecte", "d\\u", "index", "])", "_", "\\u\\u\\uNL\\u\\u\\u_", "kep", "t", "\\u", "slice", "\\u", "index_", "._", "append_", "(_", "selecte", "d\\u", "index_", ")_", "\\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 ", " _", "kep", "t", "\\u", "slice", "\\u", "index_", "=_", "beta_", ">_", "self_", "._", "epsilon_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "'''", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "pop", "ed", " ", "is", " ", "not", " ", "Non", "e", ":", "\\", "10", ";", " ", " ", " ", " ", "selecte", "d\\u", "index", " ", "=", " ", "np", ".", "delete", "(", "selecte", "d\\u", "index", ",", " ", "pop", "ed", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "kep", "t", "\\u", "seg", "\\u", "slice", "s", " ", "=", " ", "segmentation", "\\u", "slice", "s", "[", "selecte", "d\\u", "index", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "np_", "._", "asarray_", "(_", "kep", "t", "\\u", "slice", "\\u", "index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Target", "Segmentation", "Pair", "wise_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "label", "\\u", "fusion", "_", "(_", "self_", ",_", "selecte", "d\\u", "index_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Compute", " ", "the", " ", "result", "ing", " ", "segmentation", " ", "by", " ", "label", " ", "fusion", " ", "of", " ", "the", " ", "segmentation", " ", "of", " ", "the", " ", "selecte", "d", " ", "dictionar", "y", " ", "slice", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "selecte", "d\\u", "index", ":", " ", "array", " ", "of", " ", "indexe", "s", " ", "(", "as", " ", "a", " ", "boolean", " ", "array", ")", " ", "of", " ", "the", " ", "selecte", "d", " ", "dictionar", "y", " ", "slice", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", " ", "res", "\\u", "seg", "\\u", "model", "\\u", "space", ":", " ", "Image", " ", "of", " ", "the", " ", "result", "ing", " ", "segmentation", " ", "for", " ", "the", " ", "target", " ", "image", " ", "(", "in", " ", "the", " ", "model", " ", "space", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "model_", "._", "param_", "._", "seg", "\\u", "type_", "==_", "'", "wm", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "segmentation", "\\u", "slices_", "=_", "np_", "._", "asarray_", "(_", "[_", "dic", "\\u", "slice_", "._", "wm", "\\u", "seg", "\\u", "M_", "for_", "dic", "\\u", "slice_", "in_", "self_", "._", "model_", "._", "dictionary_", "._", "slices_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "segmentation", "\\u", "slices_", "=_", "np_", "._", "asarray_", "(_", "[_", "dic", "\\u", "slice_", "._", "gm", "\\u", "seg", "\\u", "M_", "for_", "dic", "\\u", "slice_", "in_", "self_", "._", "model_", "._", "dictionary_", "._", "slices_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res", "\\u", "seg", "\\u", "model", "\\u", "space_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "'''", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "'-------", "---", " ", "IN", " ", "LAB", "EL", "\\u", "FU", "SION", " ", ":", " ", "shape", " ", "selecte", "d\\u", "k", "\\u", "slice", "s", " ", "--------------", "-->", "',", " ", "selecte", "d\\u", "k", "\\u", "slice", "s", ".", "shape", ",", "\\", "10", ";", " ", " ", " ", " ", " ", "'", " ", "len", " ", "=", " ", "',", " ", "len", "(", "selecte", "d\\u", "k", "\\u", "slice", "s", ".", "shape", ")", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "'-------", "---", " ", "IN", " ", "LAB", "EL", "\\u", "FU", "SION", " ", ":", " ", "type", " ", "selecte", "d\\u", "k", "\\u", "slice", "s", "[", "0", "]", " ", "--------------", "-->", "',", " ", "type", "(", "selecte", "d\\u", "k", "\\u", "slice", "s", "[", "0", "])", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "isin", "stance", "(", "selecte", "d\\u", "slice", "s", "[", "0", "][", "0", "][", "0", "],", " ", "(", "list", ",", " ", "np", ".", "ndar", "ray", "))", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "len", "(", "selecte", "d\\u", "slice", "s", "[", "0", "].", "shape", ")", " ", "==", " ", "3", ":_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "selecte", "d\\u", "index_", "[_", "0_", "]_", ",_", "(_", "list_", ",_", "np_", "._", "ndarray_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", ",_", "selecte", "d\\u", "ind", "\\u", "by", "\\u", "slice_", "in_", "enumerate_", "(_", "selecte", "d\\u", "index_", ")_", ":_", "#", " ", "selecte", "d\\u", "slice", "s", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "slice", "\\u", "seg_", "=_", "compute", "\\u", "major", "it", "y", "\\u", "vote", "\\u", "mean", "\\u", "seg_", "(_", "segmentation", "\\u", "slices_", "[_", "selecte", "d\\u", "ind", "\\u", "by", "\\u", "slice_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res", "\\u", "seg", "\\u", "model", "\\u", "space_", "._", "append_", "(_", "slice", "\\u", "seg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "model_", "._", "param_", "._", "seg", "\\u", "type_", "==_", "'", "wm", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "target_", "[_", "i_", "]_", "._", "set_", "(_", "wm", "\\u", "seg", "\\u", "m_", "=_", "slice", "\\u", "seg_", ")_", "\\u\\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_", "._", "target_", "[_", "i_", "]_", "._", "set_", "(_", "gm", "\\u", "seg", "\\u", "m_", "=_", "slice", "\\u", "seg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "res", "\\u", "seg", "\\u", "model", "\\u", "space", " ", "=", " ", "map", "(", "compute", "\\u", "major", "it", "y", "\\u", "vote", "\\u", "mean", "\\u", "seg", ",", " ", "selecte", "d\\u", "slice", "s", ")_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "res", "\\u", "seg", "\\u", "model", "\\u", "space", " ", "=", " ", "compute", "\\u", "major", "it", "y", "\\u", "vote", "\\u", "mean", "\\u", "seg", "(", "selecte", "d\\u", "slice", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res", "\\u", "seg", "\\u", "model", "\\u", "space_", "=_", "compute", "\\u", "major", "it", "y", "\\u", "vote", "\\u", "mean", "\\u", "seg_", "(_", "segmentation", "\\u", "slices_", "[_", "selecte", "d\\u", "index_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res", "\\u", "seg", "\\u", "model", "\\u", "space_", "=_", "np_", "._", "asarray_", "(_", "res", "\\u", "seg", "\\u", "model", "\\u", "space_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "save", "\\u", "image", "(", "res", "\\u", "seg", "\\u", "model", "\\u", "space", ",", " ", "'", "res", "\\u", "GM", "\\u", "seg", "\\u", "model", "\\u", "space", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Image_", "(_", "param_", "=_", "res", "\\u", "seg", "\\u", "model", "\\u", "space_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Target", "Segmentation", "Pair", "wise_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "plot", "\\u", "projected", "\\u", "dic_", "(_", "self_", ",_", "nb", "\\u", "modes_", "=_", "3_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "plot", " ", "the", " ", "pca", " ", "first", " ", "mode", "s", " ", "and", " ", "the", " ", "target", " ", "projecti", "on", " ", "if", " ", "target", " ", "is", " ", "provided", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "on", " ", "a", " ", "second", " ", "plot", ",", " ", "highlight", " ", "the", " ", "selecte", "d", " ", "dictionar", "y", " ", "slice", "s", " ", "for", " ", "one", " ", "target", " ", "slice", " ", "in", " ", "partic", "ular", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "nb", "\\u", "mode", "s", ":", "\\", "10", ";", " ", " ", " ", " ", ":", "return", ":", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "model_", "._", "pca_", "._", "plot", "\\u", "projected", "\\u", "dic_", "(_", "nb", "\\u", "mode_", "=_", "nb", "\\u", "modes_", ",_", "target", "\\u", "coord_", "=_", "self_", "._", "coord", "\\u", "projected", "\\u", "target_", ")_", "if_", "self_", "._", "coord", "\\u", "projected", "\\u", "target_", "is_", "not_", "None_", "else_", "self_", "._", "model_", "._", "pca_", "._", "plot", "\\u", "projected", "\\u", "dic_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "model_", "._", "pca_", "._", "plot", "\\u", "projected", "\\u", "dic_", "(_", "nb", "\\u", "mode_", "=_", "nb", "\\u", "modes_", ",_", "target", "\\u", "coord_", "=_", "self_", "._", "coord", "\\u", "projected", "\\u", "target_", ",_", "to", "\\u", "highlight_", "=_", "(_", "5_", ",_", "self_", "._", "selecte", "d\\u", "k", "\\u", "slices_", "[_", "5_", "]_", ")_", ")_", "if_", "self_", "._", "coord", "\\u", "projected", "\\u", "target_", "is_", "not_", "None_", "else_", "self_", "._", "model_", "._", "pca_", "._", "plot", "\\u", "projected", "\\u", "dic_", "(_", ")_", "\\u\\u\\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_", "Target", "Segmentation", "Group", "wise_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Contain", "s", " ", "all", " ", "the", " ", "function", " ", "to", " ", "segment", " ", "the", " ", "gray", " ", "matte", "r", " ", "an", " ", "a", " ", "target", " ", "image", " ", "give", "n", " ", "a", " ", "model", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "registration", " ", "of", " ", "the", " ", "target", " ", "to", " ", "the", " ", "model", " ", "space", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "projecti", "on", " ", "of", " ", "the", " ", "target", " ", "slice", "s", " ", "on", " ", "the", " ", "reduce", "d", " ", "model", " ", "space", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "selection", " ", "of", " ", "the", " ", "model", " ", "slice", "s", " ", "most", " ", "similar", " ", "to", " ", "the", " ", "target", " ", "slice", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "computation", " ", "of", " ", "the", " ", "result", "ing", " ", "target", " ", "segmentation", " ", "by", " ", "label", " ", "fusion", " ", "of", " ", "thei", "r", " ", "segmentation", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Target", "Segmentation", "Group", "wise_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "model_", ",_", "target", "\\u", "image_", "=_", "None_", ",_", "tau_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Target", " ", "gray", " ", "matte", "r", " ", "segmentation", " ", "construct", "or", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "model", ":", " ", "Model", " ", "used", " ", "to", " ", "compute", " ", "the", " ", "segmentation", ",", " ", "type", ":", " ", "Model", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "target", "\\u", "image", ":", " ", "Target", " ", "image", " ", "to", " ", "segment", " ", "gray", " ", "matte", "r", " ", "on", ",", " ", "type", ":", " ", "Image", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "tau", ":", " ", "Weig", "hti", "ng", " ", "parameter", " ", "associate", "d", " ", "with", " ", "the", " ", "geod", "esi", "c", " ", "distance", "s", " ", "in", " ", "the", " ", "model", " ", "dictionar", "y", ",", " ", "type", ":", " ", "float", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "model_", "=_", "model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "target", " ", "image_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "target_", "=_", "target", "\\u", "image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "'''", "\\", "10", ";", " ", " ", " ", " ", "save", "\\u", "image", "(", "self", ".", "target", ".", "data", ",", " ", "'", "target", "\\u", "image", "')", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "'---", "TARGET", " ", "IMA", "GE", " ", "IN", " ", "CLASS", " ", "Target", "Segmentation", " ", ":", " ", "',", " ", "self", ".", "target", ".", "data", "\\", "10", ";", " ", " ", " ", " ", "save", "\\u", "image", "(", "self", ".", "target", ".", "data", "[", "0", "],", "'", "target", "\\u", "slice", "0", "\\u", "target", "Seg", "\\u", "'+", "self", ".", "model", ".", "param", ".", "todo", "\\u", "model", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "epsilon_", "=_", "round_", "(_", "1.0_", "/_", "self_", "._", "model_", "._", "dictionary_", "._", "J_", ",_", "5_", ")_", "-_", "0.0001_", "#", " ", "/", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "tau_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "tau_", "=_", "self_", "._", "compute", "\\u", "tau_", "(_", ")_", "\\u\\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_", "._", "tau_", "=_", "tau_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "target", "\\u", "M_", ",_", "self_", "._", "R", "\\u", "target", "\\u", "to", "\\u", "M_", "=_", "self_", "._", "target", "\\u", "group", "wis", "e\\u", "registration_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "target", "\\u", "M_", "._", "file", "\\u", "name_", "=_", "'", "target", "\\u", "model", "\\u", "space", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "target", "\\u", "M_", "._", "ext_", "=_", "'.", "ni", "i", ".", "gz", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "self", ".", "target", "\\u", "M", ".", "data", " ", "=", " ", "self", ".", "target", "\\u", "M", ".", "data", ".", "ast", "ype", "('", "float", "32", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "target", "\\u", "M_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "'-----", " ", "register", "ed", " ", "target", " ", "----", " ", "',", " ", "self", ".", "target", "\\u", "M", ".", "data", "\\", "10", ";", " ", " ", " ", " ", "save", "\\u", "image", "(", "self", ".", "target", "\\u", "M", ".", "data", ",", " ", "'", "target", "\\u", "image", "\\u", "model", "\\u", "space", "')", "\\", "10", ";", " ", " ", " ", " ", "save", "\\u", "image", "(", "self", ".", "target", "\\u", "M", ".", "data", "[", "0", "],", "'", "target", "\\u", "register", "ed", "\\u", "slice", "0", "\\u", "rigid", "reg", "\\u", "'+", "self", ".", "model", ".", "param", ".", "todo", "\\u", "model", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "coord", "\\u", "projected", "\\u", "target", " ", "is", " ", "a", " ", "list", " ", "of", " ", "all", " ", "the", " ", "coord", " ", "of", " ", "the", " ", "target", "'", "s", " ", "projected", " ", "slices_", "\\u\\u\\uNL\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Project", "ing", " ", "the", " ", "target", " ", "image", " ", "in", " ", "the", " ", "reduce", "d", " ", "common", " ", "space", " ", "...'_", ",_", "model_", "._", "param_", "._", "verbose_", ",_", "'", "normal", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "coord", "\\u", "projected", "\\u", "target_", "=_", "model_", "._", "pca_", "._", "project_", "(_", "self_", "._", "target", "\\u", "M_", ")_", "if_", "self_", "._", "target", "\\u", "M_", "is_", "not_", "None_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "'---", "-", "SHAPE", " ", "COORD", " ", "PROJECT", "ED", " ", "TARGET", " ", "-----", "',", " ", "self", ".", "coord", "\\u", "projected", "\\u", "target", ".", "shape", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "'---", "-", "COORD", " ", "PROJECT", "ED", " ", "TARGET", " ", "-----", "',", " ", "self", ".", "coord", "\\u", "projected", "\\u", "target", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "beta_", "=_", "self_", "._", "compute", "\\u", "beta_", "(_", "self_", "._", "coord", "\\u", "projected", "\\u", "target_", ",_", "tau_", "=_", "self_", "._", "tau_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "'''", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "'-------", "----", " ", "BET", "AS", " ", ":'", ",", " ", "self", ".", "beta", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "beta", " ", "=", " ", "self", ".", "compute", "\\u", "beta", "(", "self", ".", "coord", "\\u", "projected", "\\u", "target", ",", " ", "tau", "=", "0.001", "14", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Selecti", "ng", " ", "the", " ", "dictionar", "y", " ", "slice", "s", " ", "most", " ", "similar", " ", "to", " ", "the", " ", "target", " ", "...'_", ",_", "model_", "._", "param_", "._", "verbose_", ",_", "'", "normal", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "selecte", "d\\u", "k", "\\u", "slices_", "=_", "self_", "._", "select", "\\u", "k", "\\u", "slices_", "(_", "self_", "._", "beta_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "'''", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "'---", "-", "SELECTED", " ", "K", " ", "-----", "',", " ", "self", ".", "selecte", "d\\u", "k", "\\u", "slice", "s", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "'---", "-", "SHAPE", " ", "SELECTED", " ", "K", " ", "-----", "',", " ", "self", ".", "selecte", "d\\u", "k", "\\u", "slice", "s", ".", "shape", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Comp", "uti", "ng", " ", "the", " ", "result", " ", "gray", " ", "matte", "r", " ", "segmentation", " ", "...'_", ",_", "model_", "._", "param_", "._", "verbose_", ",_", "'", "normal", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "target", "\\u", "GM", "\\u", "seg", "\\u", "M_", "=_", "self_", "._", "label", "\\u", "fusion", "_", "(_", "self_", "._", "selecte", "d\\u", "k", "\\u", "slices_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "target", "\\u", "GM", "\\u", "seg", "\\u", "M_", "._", "file", "\\u", "name_", "=_", "'", "res", "\\u", "gm", "seg", "\\u", "model", "\\u", "space", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "target", "\\u", "GM", "\\u", "seg", "\\u", "M_", "._", "ext_", "=_", "'.", "ni", "i", ".", "gz", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "self", ".", "target", "\\u", "M", ".", "data", " ", "=", " ", "self", ".", "target", "\\u", "M", ".", "data", ".", "ast", "ype", "('", "float", "32", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "target", "\\u", "GM", "\\u", "seg", "\\u", "M_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Register", "ing", " ", "the", " ", "result", " ", "gray", " ", "matte", "r", " ", "segmentation", " ", "back", " ", "int", "o", " ", "the", " ", "target", " ", "original", " ", "space", "...'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model_", "._", "param_", "._", "verbose_", ",_", "'", "normal", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "target", "\\u", "GM", "\\u", "seg_", "=_", "self_", "._", "target", "\\u", "group", "wis", "e\\u", "registration_", "(_", "inverse_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Target", "Segmentation", "Group", "wise_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compute", "\\u", "beta_", "(_", "self_", ",_", "coord", "\\u", "target_", ",_", "dataset", "\\u", "coord_", "=_", "None_", ",_", "tau_", "=_", "0.01_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Compute", " ", "the", " ", "model", " ", "similar", "it", "y", " ", "(", "beta", ")", " ", "bet", "ween", " ", "each", " ", "model", " ", "slice", " ", "and", " ", "each", " ", "target", " ", "image", " ", "slice", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "beta", "\\u", "j", " ", "=", " ", "(", "1", "/", "Z", ")", "exp", "(-", "tau", "*", "square", "\\u", "norm", "(", "target", "\\u", "coordinate", " ", "-", " ", "slice", "\\u", "j", "\\u", "coordinate", "))\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Z", " ", "is", " ", "the", " ", "partit", "ion", " ", "function", " ", "tha", "t", " ", "enforce", "s", " ", "the", " ", "constraint", " ", "tha", "t", " ", "sum", "(", "beta", ")=", "1", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "coord", "\\u", "target", ":", " ", "coordinate", "s", " ", "of", " ", "the", " ", "target", " ", "image", " ", "in", " ", "the", " ", "reduce", "d", " ", "model", " ", "space", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "tau", ":", " ", "weighting", " ", "parameter", " ", "indicati", "ng", " ", "the", " ", "deca", "y", " ", "constant", " ", "associate", "d", " ", "with", " ", "a", " ", "geod", "esi", "c", " ", "distance", "\\", "10", ";", " ", " ", " ", " ", "bet", "ween", " ", "a", " ", "give", "n", " ", "dictionar", "y", " ", "slice", " ", "and", " ", "a", " ", "projected", " ", "target", " ", "image", " ", "slice", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", ":", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dataset", "\\u", "coord_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "in", " ", "the", " ", "dataset", "\\u", "coord", " ", "matrix", ",", " ", "each", " ", "column", " ", "correspond", " ", "to", " ", "the", " ", "projecti", "on", " ", "of", " ", "one", " ", "of", " ", "the", " ", "original", " ", "data", " ", "image", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "transpose", " ", "opera", "tor", " ", ".", "T", " ", "enable", " ", "the", " ", "loop", " ", "to", " ", "iterate", " ", "over", " ", "all", " ", "the", " ", "images", " ", "coord_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dataset", "\\u", "coord_", "=_", "self_", "._", "model_", "._", "pca_", "._", "dataset", "\\u", "coord_", "._", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "beta_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "'''", "\\", "10", ";", " ", " ", " ", " ", "sct", ".", "print", "v", "('", "-----------", " ", "COMP", "UT", "ING", " ", "BET", "A", " ", "--------------", "',", " ", "1", ",", " ", "'", "info", "')", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "'-----", "-", " ", "TA", "U", " ", "=", " ", "',", " ", "tau", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "'-------", "---", " ", "IN", " ", "BET", "A", " ", ":", " ", "coord", "\\u", "target", " ", "--------------", "-->", "',", " ", "coord", "\\u", "target", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "'-------", "---", " ", "IN", " ", "BET", "A", " ", ":", " ", "shape", " ", "coord", "\\u", "target", " ", "--------------", "-->", "',", " ", "coord", "\\u", "target", ".", "shape", ",", " ", "'", " ", "len", " ", "=", " ", "',", "\\", "10", ";", " ", " ", " ", " ", " ", "len", "(", "coord", "\\u", "target", ".", "shape", ")", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "'-------", "---", " ", "IN", " ", "BET", "A", " ", ":", " ", "type", " ", "coord", "\\u", "target", "[", "0", "][", "0", "]", " ", "--------------", "-->", "',", " ", "type", "(", "coord", "\\u", "target", "[", "0", "][", "0", "])", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "SEE", " ", "IF", " ", "WE", " ", "NEED", " ", "TO", " ", "CHECK", " ", "THE", " ", "SECOND", " ", "DIMENSION", " ", "OF", " ", "COORD", " ", "TARGET", " ", "OR", " ", "THE", " ", "FIR", "ST", " ", "..._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "coord", "\\u", "target_", "[_", "0_", "]_", ",_", "(_", "list_", ",_", "np_", "._", "ndarray_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i", "\\u", "target_", ",_", "coord", "\\u", "projected", "\\u", "slice_", "in_", "enumerate_", "(_", "coord", "\\u", "target_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta", "\\u", "slice_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "coord", "\\u", "slice", "\\u", "j_", "in_", "dataset", "\\u", "coord_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "square", "\\u", "norm_", "=_", "np_", "._", "linalg_", "._", "norm_", "(_", "(_", "coord", "\\u", "projected", "\\u", "slice_", "-_", "coord", "\\u", "slice", "\\u", "j_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta", "\\u", "slice_", "._", "append_", "(_", "exp_", "(_", "-_", "tau_", "*_", "square", "\\u", "norm_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "'''", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "'", "beta", " ", "case", " ", "1", " ", ":'", ",", " ", "beta", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "'--", ">", " ", "sum", " ", "beta", " ", "',", " ", "Z", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "np_", "._", "sum_", "(_", "beta", "\\u", "slice_", ")_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "beta", "\\u", "slice_", "/=_", "np_", "._", "sum_", "(_", "beta", "\\u", "slice_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Zero", "Divis", "ion", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sct", "_", "._", "print", "v_", "(_", "'", "WARN", "ING", " ", ":", " ", "similar", "iti", "es", " ", "are", " ", "null", "'_", ",_", "self_", "._", "model_", "._", "param_", "._", "verbose_", ",_", "'", "warn", "ing", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "beta", "\\u", "slice_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "beta_", "._", "append_", "(_", "beta", "\\u", "slice_", ")_", "\\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_", "coord", "\\u", "slice", "\\u", "j_", "in_", "dataset", "\\u", "coord_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "square", "\\u", "norm_", "=_", "np_", "._", "linalg_", "._", "norm_", "(_", "(_", "coord", "\\u", "target_", "-_", "coord", "\\u", "slice", "\\u", "j_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "append_", "(_", "exp_", "(_", "-_", "tau_", "*_", "square", "\\u", "norm_", ")_", ")_", "\\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 ", " _", "beta_", "/=_", "np_", "._", "sum_", "(_", "beta_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Zero", "Divis", "ion", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sct", "_", "._", "print", "v_", "(_", "'", "WARN", "ING", " ", ":", " ", "similar", "iti", "es", " ", "are", " ", "null", "'_", ",_", "self_", "._", "model_", "._", "param_", "._", "verbose_", ",_", "'", "warn", "ing", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "beta_", "\\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_", "np_", "._", "asarray_", "(_", "beta_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Target", "Segmentation", "Group", "wise_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compute", "\\u", "tau_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Compute", " ", "the", " ", "weighting", " ", "parameter", " ", "indicati", "ng", " ", "the", " ", "deca", "y", " ", "constant", " ", "associate", "d", " ", "with", " ", "a", " ", "geod", "esi", "c", " ", "distance", "\\", "10", ";", " ", " ", " ", " ", "bet", "ween", " ", "a", " ", "give", "n", " ", "dictionar", "y", " ", "slice", " ", "and", " ", "a", " ", "projected", " ", "target", " ", "image", " ", "slice", "\\", "10", ";", " ", " ", " ", " ", ":", "return", ":", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Comp", "uti", "ng", " ", "Tau", " ", "...", " ", "\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "Tau", " ", "is", " ", "a", " ", "weighting", " ", "parameter", " ", "indicati", "ng", " ", "the", " ", "deca", "y", " ", "constant", " ", "associate", "d", " ", "with", " ", "a", " ", "geod", "esi", "c", " ", "distance", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bet", "ween", " ", "a", " ", "give", "n", " ", "atlas", " ", "and", " ", "a", " ", "projected", " ", "target", " ", "image", ",", " ", "see", " ", "As", "man", " ", "pape", "r", ",", " ", "eq", " ", "(", "16", "))'_", ",_", "1_", ",_", "'", "normal", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "scipy_", "._", "optimize_", "import_", "minimize_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "to", "\\u", "minimize_", "(_", "tau_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Compute", " ", "the", " ", "sum", " ", "of", " ", "the", " ", "L0", " ", "norm", " ", "bet", "ween", " ", "a", " ", "slice", " ", "segmentation", " ", "and", " ", "the", " ", "result", "ing", " ", "segmentation", " ", "tha", "t", " ", "wou", "ld", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "found", " ", "if", " ", "the", " ", "slice", " ", "was", " ", "a", " ", "target", " ", "image", " ", "for", " ", "a", " ", "give", "n", " ", "tau", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "a", " ", "give", "n", " ", "model", ",", " ", "Tau", " ", "is", " ", "the", " ", "parameter", " ", "tha", "t", " ", "wou", "ld", " ", "minimize", " ", "this", " ", "function", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "tau", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", " ", "sum", "\\u", "norm", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sum", "\\u", "norm_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "dic", "\\u", "slice_", "in_", "self_", "._", "model_", "._", "dictionary_", "._", "slices_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "projected", "\\u", "dic", "\\u", "slice", "\\u", "coord_", "=_", "self_", "._", "model_", "._", "pca_", "._", "project", "\\u", "array_", "(_", "dic", "\\u", "slice_", "._", "im", "\\u", "M", "\\u", "flat_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "coord", "\\u", "dic", "\\u", "slice", "\\u", "dataset_", "=_", "np_", "._", "delete_", "(_", "self_", "._", "model_", "._", "pca_", "._", "dataset", "\\u", "coord_", "._", "T_", ",_", "dic", "\\u", "slice_", "._", "id_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta", "\\u", "dic", "\\u", "slice_", "=_", "self_", "._", "compute", "\\u", "beta_", "(_", "projected", "\\u", "dic", "\\u", "slice", "\\u", "coord_", ",_", "dataset", "\\u", "coord_", "=_", "coord", "\\u", "dic", "\\u", "slice", "\\u", "dataset_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tau_", "=_", "tau_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kj", "_", "=_", "self_", "._", "select", "\\u", "k", "\\u", "slices_", "(_", "beta", "\\u", "dic", "\\u", "slice_", ")_", "#", " ", ",", " ", "pop", "ed", "=", "dic", "\\u", "slice", ".", "id", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "est", "\\u", "segm", "\\u", "j_", "=_", "self_", "._", "label", "\\u", "fusion", "_", "(_", "kj", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sum", "\\u", "norm_", "+=_", "l", "0", "\\u", "norm_", "(_", "dic", "\\u", "slice_", "._", "seg", "\\u", "M_", ",_", "est", "\\u", "segm", "\\u", "j_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "sum", "\\u", "norm_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "est", "\\u", "tau_", "=_", "minimize_", "(_", "to", "\\u", "minimize_", ",_", "0_", ",_", "method_", "=_", "'", "Ne", "lder", "-", "Mea", "d", "'_", ",_", "options_", "=_", "{_", "'", "xt", "ol", "'_", ":_", "0.0005", "_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'", "Estimated", " ", "tau", " ", ":", " ", "'_", "+_", "str_", "(_", "est", "\\u", "tau_", "._", "x_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "model_", "._", "param_", "._", "todo", "\\u", "model_", "==_", "'", "compute", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fic", "_", "=_", "open_", "(_", "self_", "._", "model_", "._", "dictionary_", "._", "model", "\\u", "dic", "\\u", "name_", "+_", "'/", "tau", ".", "txt", "'_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fic", "_", "._", "write_", "(_", "str_", "(_", "est", "\\u", "tau_", "._", "x_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fic", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "float_", "(_", "est", "\\u", "tau_", "._", "x_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Target", "Segmentation", "Group", "wise_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compute", "\\u", "mu_", "(_", "self_", ",_", "beta_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Compute", " ", "the", " ", "weight", "ed", " ", "mean", " ", "of", " ", "the", " ", "dictionar", "y", " ", "slice", "s", " ", "projecti", "on", " ", "weight", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "beta", ":", " ", "similar", "iti", "es", " ", "vector", " ", "for", " ", "one", " ", "target", " ", "slice", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", " ", "mu", ":", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "'''", "\\", "10", ";", " ", " ", " ", " ", "mu", " ", "=", " ", "[]", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "beta", "\\u", "slice", " ", "in", " ", "beta", ":", "\\", "10", ";", " ", " ", " ", " ", "mu", ".", "append", "(", "self", ".", "model", ".", "pca", ".", "dataset", "\\u", "coord", ".", "dot", "(", "beta", "\\u", "slice", "))\\", "10", ";", " ", " ", " ", " ", "return", " ", "np", ".", "asa", "rray", "(", "mu", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "model_", "._", "pca_", "._", "dataset", "\\u", "coord_", "._", "dot_", "(_", "beta_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Target", "Segmentation", "Group", "wise_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compute", "\\u", "sigma_", "(_", "self_", ",_", "beta_", ",_", "mu_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Compute", " ", "the", " ", "weight", "ed", " ", "standard", " ", "deviation", " ", "of", " ", "the", " ", "dictionar", "y", " ", "slice", "s", " ", "projecti", "on", " ", "weight", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "beta", ":", " ", "similar", "iti", "es", " ", "vector", " ", "for", " ", "one", " ", "target", " ", "slice", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "mu", ":", " ", "weight", "ed", " ", "mean", " ", "of", " ", "the", " ", "dictionar", "y", " ", "slice", "s", " ", "projecti", "on", " ", "weight", "s", " ", "for", " ", "one", " ", "target", " ", "slice", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", " ", "sigma", ":", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "'''", "\\", "10", ";", " ", " ", " ", " ", "sigma", " ", "=", " ", "[]", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "beta", "\\u", "slice", ",", " ", "mu", "\\u", "slice", " ", "in", " ", "zip", "(", "beta", ",", " ", "mu", "):", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "sigma", ".", "append", "([", "beta", "\\u", "slice", ".", "dot", "((", "self", ".", "model", ".", "pca", ".", "dataset", "\\u", "coord", "[", "v", ",", " ", ":]", " ", "-", " ", "mu", "\\u", "slice", "[", "v", "])", " ", "**", " ", "2", ")", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "v", " ", "in", " ", "range", "(", "len", "(", "mu", "\\u", "slice", "))", "])", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "np", ".", "asa", "rray", "(", "sigma", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "np_", "._", "asarray_", "(_", "[_", "beta_", "._", "dot_", "(_", "(_", "self_", "._", "model_", "._", "pca_", "._", "dataset", "\\u", "coord_", "[_", "v_", ",_", ":_", "]_", "-_", "mu_", "[_", "v_", "]_", ")_", "**_", "2_", ")_", "for_", "v_", "in_", "range_", "(_", "len_", "(_", "mu_", ")_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Target", "Segmentation", "Group", "wise_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "target", "\\u", "group", "wis", "e\\u", "registration_", "(_", "self_", ",_", "inverse_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Register", " ", "the", " ", "target", " ", "image", " ", "int", "o", " ", "the", " ", "model", " ", "space", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Affi", "ne", " ", "(", "or", " ", "rigid", " ", "+", " ", "affin", "e", ")", " ", "registration", " ", "of", " ", "the", " ", "target", " ", "on", " ", "the", " ", "mean", " ", "model", " ", "image", " ", "-->", " ", "pairwise", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "inv", "erse", ":", " ", "if", " ", "Tru", "e", ",", " ", "appl", "y", " ", "the", " ", "inv", "erse", " ", "warp", "ing", " ", "field", " ", "of", " ", "the", " ", "registration", " ", "target", " ", "->", " ", "model", " ", "space", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "the", " ", "result", " ", "gray", " ", "matte", "r", " ", "segmentation", " ", "of", " ", "the", " ", "target", "\\", "10", ";", " ", " ", " ", " ", "(", "put", " ", "it", " ", "back", " ", "in", " ", "it", "'", "s", " ", "original", " ", "space", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "inverse_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Registration", " ", "target", " ", "-->", " ", "model", " ", "space_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "scipy_", "._", "optimize_", "import_", "minimize_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Initial", "isat", "ion_", "\\u\\u\\uNL\\u\\u\\u_", "target", "\\u", "m_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "to", "\\u", "minimize_", "(_", "t", "\\u", "param_", ",_", "n", "\\u", "slice_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", " ", "sum", "\\u", "norm", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "moved", "\\u", "target", "\\u", "slice_", "=_", "Image_", "(_", "param_", "=_", "np_", "._", "asarray_", "(_", "appl", "y", "\\u", "2d", "\\u", "transformation_", "(_", "self_", "._", "target_", "._", "data_", "[_", "n", "\\u", "slice_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tx_", "=_", "t", "\\u", "param_", "[_", "0_", "]_", ",_", "ty_", "=_", "t", "\\u", "param_", "[_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "theta_", "=_", "t", "\\u", "param_", "[_", "2_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "t", "\\u", "param_", "[_", "3_", "]_", ")_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "coord", "\\u", "moved", "\\u", "target_", "=_", "self_", "._", "model_", "._", "pca_", "._", "project", "\\u", "array_", "(_", "moved", "\\u", "target", "\\u", "slice_", "._", "data_", "._", "flatten_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coord", "\\u", "moved", "\\u", "target_", "=_", "coord", "\\u", "moved", "\\u", "target_", "._", "reshape_", "(_", "coord", "\\u", "moved", "\\u", "target_", "._", "shape_", "[_", "0_", "]_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "=_", "self_", "._", "compute", "\\u", "beta_", "(_", "coord", "\\u", "moved", "\\u", "target_", ",_", "tau_", "=_", "self_", "._", "tau_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mu_", "=_", "self_", "._", "compute", "\\u", "mu_", "(_", "beta_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sigma_", "=_", "self_", "._", "compute", "\\u", "sigma_", "(_", "beta_", ",_", "mu_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "target", "\\u", "th", "\\u", "slice_", "=_", "np_", "._", "sum_", "(_", "(_", "np_", "._", "asarray_", "(_", "[_", "dic", "\\u", "slice_", "._", "im", "\\u", "M_", "for_", "dic", "\\u", "slice_", "in_", "self_", "._", "model_", "._", "dictionary_", "._", "slices_", "]_", ")_", "._", "T_", "\\u\\u\\uNL\\u\\u\\u_", "*_", "beta_", "[_", "n", "\\u", "slice_", "]_", ")_", "._", "T_", ",_", "axis_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sq", "\\u", "norm_", "=_", "np_", "._", "linalg_", "._", "norm_", "(_", "target", "\\u", "th", "\\u", "slice_", "-_", "moved", "\\u", "target", "\\u", "slice_", "._", "data_", ",_", "2_", ")_", "**_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gauss_", "=_", "np_", "._", "sum_", "(_", "(_", "(_", "coord", "\\u", "moved", "\\u", "target_", "-_", "mu_", ")_", "/_", "sigma_", ")_", "**_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "sq", "\\u", "norm_", "*_", "gauss_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "r", "\\u", "target", "\\u", "to", "\\u", "m_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i", "\\u", "slice_", ",_", "target", "\\u", "slice_", "in_", "enumerate_", "(_", "self_", "._", "target_", "._", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x0_", "=_", "[_", "0_", ",_", "0_", ",_", "0_", ",_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "est", "\\u", "transf", "o_", "=_", "minimize_", "(_", "to", "\\u", "minimize_", ",_", "x0_", ",_", "args_", "=_", "i", "\\u", "slice_", ",_", "method_", "=_", "'", "Ne", "lder", "-", "Mea", "d", "'_", ",_", "options_", "=_", "{_", "'", "xt", "ol", "'_", ":_", "0.0000", "5_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target", "\\u", "m", "\\u", "slice_", ",_", "r", "\\u", "slice_", "=_", "appl", "y", "\\u", "2d", "\\u", "transformation_", "(_", "target", "\\u", "slice_", ",_", "tx_", "=_", "est", "\\u", "transf", "o_", "._", "x_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ty_", "=_", "est", "\\u", "transf", "o_", "._", "x_", "[_", "1_", "]_", ",_", "theta_", "=_", "est", "\\u", "transf", "o_", "._", "x_", "[_", "2_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "est", "\\u", "transf", "o_", "._", "x_", "[_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "est", "\\u", "transf", "o_", "._", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target", "\\u", "m_", "._", "append_", "(_", "target", "\\u", "m", "\\u", "slice_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r", "\\u", "target", "\\u", "to", "\\u", "m_", "._", "append_", "(_", "r", "\\u", "slice_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Image_", "(_", "param_", "=_", "np_", "._", "asarray_", "(_", "target", "\\u", "m_", ")_", ")_", ",_", "r", "\\u", "target", "\\u", "to", "\\u", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Inv", "erse", " ", "registration", " ", "result", " ", "in", " ", "model", " ", "space", " ", "-->", " ", "target", " ", "original", " ", "space_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "moved", "\\u", "res_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i", "\\u", "slice_", ",_", "res", "\\u", "m", "\\u", "slice_", "in_", "enumerate_", "(_", "self_", "._", "target", "\\u", "GM", "\\u", "seg", "\\u", "M_", "._", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "moved", "\\u", "res_", "._", "append_", "(_", "appl", "y", "\\u", "2d", "\\u", "transformation_", "(_", "res", "\\u", "m", "\\u", "slice_", ",_", "transf", "o_", "=_", "self_", "._", "R", "\\u", "target", "\\u", "to", "\\u", "M_", "[_", "i", "\\u", "slice_", "]_", "._", "inverse_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Image_", "(_", "np_", "._", "asarray_", "(_", "moved", "\\u", "res_", ")_", "._", "astype_", "(_", "'", "uint", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Target", "Segmentation", "Group", "wise_", ":_", "\\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_", "select", "\\u", "k", "\\u", "slices_", "(_", "self_", ",_", "beta_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Select", " ", "the", " ", "K", " ", "dictionar", "y", " ", "slice", "s", " ", "most", " ", "similar", " ", "to", " ", "the", " ", "target", " ", "slice", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "beta", ":", " ", "Dict", "ionar", "y", " ", "similar", "iti", "es", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", " ", "selecte", "d", ":", " ", "nump", "y", " ", "array", " ", "of", " ", "segmentation", " ", "of", " ", "the", " ", "selecte", "d", " ", "dictionar", "y", " ", "slice", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "kep", "t", "\\u", "slice", "\\u", "index_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "beta_", "[_", "0_", "]_", ",_", "(_", "list_", ",_", "np_", "._", "ndarray_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "beta", "\\u", "slice_", "in_", "beta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "selecte", "d\\u", "index_", "=_", "beta", "\\u", "slice_", ">_", "self_", "._", "epsilon_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "'''", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "pop", "ed", " ", "is", " ", "not", " ", "Non", "e", ":", "\\", "10", ";", " ", " ", "selecte", "d\\u", "index", " ", "=", " ", "np", ".", "delete", "(", "selecte", "d\\u", "index", ",", " ", "pop", "ed", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "kep", "t", "\\u", "seg", "\\u", "slice", "s", ".", "append", "(", "segmentation", "\\u", "slice", "s", "[", "selecte", "d\\u", "index", "])", "_", "\\u\\u\\uNL\\u\\u\\u_", "kep", "t", "\\u", "slice", "\\u", "index_", "._", "append_", "(_", "selecte", "d\\u", "index_", ")_", "\\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 ", " _", "kep", "t", "\\u", "slice", "\\u", "index_", "=_", "beta_", ">_", "self_", "._", "epsilon_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "'''", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "pop", "ed", " ", "is", " ", "not", " ", "Non", "e", ":", "\\", "10", ";", " ", " ", " ", " ", "selecte", "d\\u", "index", " ", "=", " ", "np", ".", "delete", "(", "selecte", "d\\u", "index", ",", " ", "pop", "ed", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "kep", "t", "\\u", "seg", "\\u", "slice", "s", " ", "=", " ", "segmentation", "\\u", "slice", "s", "[", "selecte", "d\\u", "index", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "np_", "._", "asarray_", "(_", "kep", "t", "\\u", "slice", "\\u", "index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Target", "Segmentation", "Group", "wise_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "label", "\\u", "fusion", "_", "(_", "self_", ",_", "selecte", "d\\u", "index_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Compute", " ", "the", " ", "result", "ing", " ", "segmentation", " ", "by", " ", "label", " ", "fusion", " ", "of", " ", "the", " ", "segmentation", " ", "of", " ", "the", " ", "selecte", "d", " ", "dictionar", "y", " ", "slice", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "selecte", "d\\u", "index", ":", " ", "array", " ", "of", " ", "indexe", "s", " ", "(", "as", " ", "a", " ", "boolean", " ", "array", ")", " ", "of", " ", "the", " ", "selecte", "d", " ", "dictionar", "y", " ", "slice", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", " ", "res", "\\u", "seg", "\\u", "model", "\\u", "space", ":", " ", "Image", " ", "of", " ", "the", " ", "result", "ing", " ", "segmentation", " ", "for", " ", "the", " ", "target", " ", "image", " ", "(", "in", " ", "the", " ", "model", " ", "space", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "segmentation", "\\u", "slices_", "=_", "np_", "._", "asarray_", "(_", "[_", "dic", "\\u", "slice_", "._", "seg", "\\u", "M_", "for_", "dic", "\\u", "slice_", "in_", "self_", "._", "model_", "._", "dictionary_", "._", "slices_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res", "\\u", "seg", "\\u", "model", "\\u", "space_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "isin", "stance", "(", "selecte", "d\\u", "slice", "s", "[", "0", "][", "0", "][", "0", "],", " ", "(", "list", ",", " ", "np", ".", "ndar", "ray", "))", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "len", "(", "selecte", "d\\u", "slice", "s", "[", "0", "].", "shape", ")", " ", "==", " ", "3", ":_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "selecte", "d\\u", "index_", "[_", "0_", "]_", ",_", "(_", "list_", ",_", "np_", "._", "ndarray_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "selecte", "d\\u", "ind", "\\u", "by", "\\u", "slice_", "in_", "selecte", "d\\u", "index_", ":_", "#", " ", "selecte", "d\\u", "slice", "s", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "slice", "\\u", "seg_", "=_", "compute", "\\u", "major", "it", "y", "\\u", "vote", "\\u", "mean", "\\u", "seg_", "(_", "segmentation", "\\u", "slices_", "[_", "selecte", "d\\u", "ind", "\\u", "by", "\\u", "slice_", "]_", ",_", "threshold_", "=_", "0.3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res", "\\u", "seg", "\\u", "model", "\\u", "space_", "._", "append_", "(_", "slice", "\\u", "seg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "res", "\\u", "seg", "\\u", "model", "\\u", "space", " ", "=", " ", "map", "(", "compute", "\\u", "major", "it", "y", "\\u", "vote", "\\u", "mean", "\\u", "seg", ",", " ", "selecte", "d\\u", "slice", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "res", "\\u", "seg", "\\u", "model", "\\u", "space", " ", "=", " ", "compute", "\\u", "major", "it", "y", "\\u", "vote", "\\u", "mean", "\\u", "seg", "(", "selecte", "d\\u", "slice", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res", "\\u", "seg", "\\u", "model", "\\u", "space_", "=_", "compute", "\\u", "major", "it", "y", "\\u", "vote", "\\u", "mean", "\\u", "seg_", "(_", "segmentation", "\\u", "slices_", "[_", "selecte", "d\\u", "index_", "]_", ",_", "threshold_", "=_", "0.3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res", "\\u", "seg", "\\u", "model", "\\u", "space_", "=_", "np_", "._", "asarray_", "(_", "res", "\\u", "seg", "\\u", "model", "\\u", "space_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "save", "\\u", "image", "(", "res", "\\u", "seg", "\\u", "model", "\\u", "space", ",", " ", "'", "res", "\\u", "GM", "\\u", "seg", "\\u", "model", "\\u", "space", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Image_", "(_", "param_", "=_", "res", "\\u", "seg", "\\u", "model", "\\u", "space_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Target", "Segmentation", "Group", "wise_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "plot", "\\u", "projected", "\\u", "dic_", "(_", "self_", ",_", "nb", "\\u", "modes_", "=_", "3_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "plot", " ", "the", " ", "pca", " ", "first", " ", "mode", "s", " ", "and", " ", "the", " ", "target", " ", "projecti", "on", " ", "if", " ", "target", " ", "is", " ", "provided", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "on", " ", "a", " ", "second", " ", "plot", ",", " ", "highlight", " ", "the", " ", "selecte", "d", " ", "dictionar", "y", " ", "slice", "s", " ", "for", " ", "one", " ", "target", " ", "slice", " ", "in", " ", "partic", "ular", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "nb", "\\u", "mode", "s", ":", "\\", "10", ";", " ", " ", " ", " ", ":", "return", ":", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "model_", "._", "pca_", "._", "plot", "\\u", "projected", "\\u", "dic_", "(_", "nb", "\\u", "mode_", "=_", "nb", "\\u", "modes_", ",_", "target", "\\u", "coord_", "=_", "self_", "._", "coord", "\\u", "projected", "\\u", "target_", ")_", "if_", "self_", "._", "coord", "\\u", "projected", "\\u", "target_", "is_", "not_", "None_", "else_", "self_", "._", "model_", "._", "pca_", "._", "plot", "\\u", "projected", "\\u", "dic_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "model_", "._", "pca_", "._", "plot", "\\u", "projected", "\\u", "dic_", "(_", "nb", "\\u", "mode_", "=_", "nb", "\\u", "modes_", ",_", "target", "\\u", "coord_", "=_", "self_", "._", "coord", "\\u", "projected", "\\u", "target_", ",_", "to", "\\u", "highlight_", "=_", "(_", "6_", ",_", "self_", "._", "selecte", "d\\u", "k", "\\u", "slices_", "[_", "6_", "]_", ")_", ")_", "if_", "self_", "._", "coord", "\\u", "projected", "\\u", "target_", "is_", "not_", "None_", "else_", "self_", "._", "model_", "._", "pca_", "._", "plot", "\\u", "projected", "\\u", "dic_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "self_", "._", "selecte", "d\\u", "k", "\\u", "slices_", "[_", "6_", "]_", "\\u\\u\\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_", "GM", "seg", "Supervis", "ed", "Method_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Gra", "y", " ", "matte", "r", " ", "segmentation", " ", "supervis", "ed", " ", "method", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Load", " ", "a", " ", "dictionar", "y", " ", "(", "train", "ing", " ", "data", " ", "set", "),", " ", "compute", " ", "or", " ", "load", " ", "a", " ", "model", " ", "from", " ", "this", " ", "dictionar", "y", "\\", "10", ";", "sct", "\\u", "Image", "\\", "10", ";", " ", " ", " ", " ", "Load", " ", "a", " ", "target", " ", "image", " ", "to", " ", "segment", " ", "and", " ", "do", " ", "the", " ", "segmentation", " ", "usi", "ng", " ", "the", " ", "model", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "GM", "seg", "Supervis", "ed", "Method_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "target", "\\u", "fname_", ",_", "gm", "\\u", "seg", "\\u", "param_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "dictionary_", "=_", "Model", "Dict", "ionar", "y", "By", "Slice_", "(_", "dic", "\\u", "param_", "=_", "gm", "\\u", "seg", "\\u", "param_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Building", " ", "the", " ", "appearance", " ", "model", "...'_", ",_", "verbose_", "=_", "gm", "\\u", "seg", "\\u", "param_", "._", "verbose_", ",_", "type_", "=_", "'", "normal", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "build", " ", "the", " ", "appearance", " ", "model_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "model_", "=_", "Model_", "(_", "model", "\\u", "param_", "=_", "gm", "\\u", "seg", "\\u", "param_", ",_", "dictionary_", "=_", "self_", "._", "dictionary_", ",_", "k_", "=_", "0.8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Construct", "ing", " ", "target", " ", "image", " ", "...'_", ",_", "verbose_", "=_", "gm", "\\u", "seg", "\\u", "param_", "._", "verbose_", ",_", "type_", "=_", "'", "normal", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "construct", " ", "target", " ", "image_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "target", "\\u", "image_", "=_", "Image_", "(_", "target", "\\u", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tau_", "=_", "None_", "#", " ", "0.000", "765", "625", " ", " ", "#", " ", "0.0002", "5", " ", " ", "#", " ", "0.000", "982", "421", "875", " ", " ", "#", " ", "0.000", "906", "25", " ", " ", "#", " ", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "gm", "\\u", "seg", "\\u", "param_", "._", "todo", "\\u", "model_", "==_", "'", "load", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fic", "_", "=_", "open_", "(_", "self_", "._", "model_", "._", "dictionary_", "._", "model", "\\u", "dic", "\\u", "name_", "+_", "'/", "tau", ".", "txt", "'_", ",_", "'", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tau_", "=_", "float_", "(_", "fic", "_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fic", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "build", " ", "a", " ", "target", " ", "segmentation_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "level", "s", "\\u", "im_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "gm", "\\u", "seg", "\\u", "param_", "._", "level", "\\u", "fname_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "gm", "\\u", "seg", "\\u", "param_", "._", "level", "\\u", "fname_", ",_", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "in", " ", "this", " ", "case", " ", "the", " ", "level", " ", "is", " ", "a", " ", "string", " ", "and", " ", "not", " ", "an", " ", "image_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "level", "s", "\\u", "im_", "=_", "gm", "\\u", "seg", "\\u", "param_", "._", "level", "\\u", "fname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "level", "s", "\\u", "im_", "=_", "Image_", "(_", "gm", "\\u", "seg", "\\u", "param_", "._", "level", "\\u", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "gm", "\\u", "seg", "\\u", "param_", "._", "target", "\\u", "reg_", "==_", "'", "pairwise", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "level", "s", "\\u", "im_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "target", "\\u", "seg", "\\u", "methods_", "=_", "Target", "Segmentation", "Pair", "wise_", "(_", "self_", "._", "model_", ",_", "target", "\\u", "image_", "=_", "self_", "._", "target", "\\u", "image_", ",_", "level", "s", "\\u", "image_", "=_", "level", "s", "\\u", "im_", ",_", "tau_", "=_", "tau_", ")_", "\\u\\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_", "._", "target", "\\u", "seg", "\\u", "methods_", "=_", "Target", "Segmentation", "Pair", "wise_", "(_", "self_", "._", "model_", ",_", "target", "\\u", "image_", "=_", "self_", "._", "target", "\\u", "image_", ",_", "tau_", "=_", "tau_", ")_", "\\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_", "gm", "\\u", "seg", "\\u", "param_", "._", "target", "\\u", "reg_", "==_", "'", "group", "wis", "e", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "target", "\\u", "seg", "\\u", "methods_", "=_", "Target", "Segmentation", "Group", "wise_", "(_", "self_", "._", "model_", ",_", "target", "\\u", "image_", "=_", "self_", "._", "target", "\\u", "image_", ",_", "tau_", "=_", "tau_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "suffix_", "=_", "'\\u'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suffix_", "+=_", "gm", "\\u", "seg", "\\u", "param_", "._", "target", "\\u", "reg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suffix_", "+=_", "gm", "\\u", "seg", "\\u", "param_", "._", "seg", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "transf", "o_", "in_", "self_", "._", "dictionary_", "._", "core", "gist", "ration", "\\u", "transf", "os_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "suffix_", "+=_", "'\\u'_", "+_", "transf", "o_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "level", "s", "\\u", "im_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "suffix_", "+=_", "'\\u", "with", "\\u", "level", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "suffix_", "+=_", "'\\u", "no", "\\u", "level", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "save", " ", "the", " ", "result", " ", "gray", " ", "matte", "r", " ", "segmentation_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", ".", "res", "\\u", "GM", "\\u", "seg", " ", "=", " ", "self", ".", "target", "\\u", "seg", "\\u", "method", "s", ".", "target", "\\u", "GM", "\\u", "seg_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "gm", "\\u", "seg", "\\u", "param_", "._", "seg", "\\u", "type_", "==_", "'", "wm", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "self_", "._", "target", "\\u", "seg", "\\u", "methods_", "._", "target_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "res_", "=_", "Image_", "(_", "param_", "=_", "np_", "._", "asarray_", "(_", "self_", "._", "target", "\\u", "seg", "\\u", "methods_", "._", "target_", "[_", "0_", "]_", "._", "wm", "\\u", "seg_", ")_", ")_", "\\u\\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_", "._", "res_", "=_", "Image_", "(_", "param_", "=_", "np_", "._", "asarray_", "(_", "[_", "target", "\\u", "slice_", "._", "wm", "\\u", "seg_", "for_", "target", "\\u", "slice_", "in_", "self_", "._", "target", "\\u", "seg", "\\u", "methods_", "._", "target_", "]_", ")_", ")_", "\\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_", "len_", "(_", "self_", "._", "target", "\\u", "seg", "\\u", "methods_", "._", "target_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "res_", "=_", "Image_", "(_", "param_", "=_", "np_", "._", "asarray_", "(_", "self_", "._", "target", "\\u", "seg", "\\u", "methods_", "._", "target_", "[_", "0_", "]_", "._", "gm", "\\u", "seg_", ")_", ")_", "\\u\\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_", "._", "res_", "=_", "Image_", "(_", "param_", "=_", "np_", "._", "asarray_", "(_", "[_", "target", "\\u", "slice_", "._", "gm", "\\u", "seg_", "for_", "target", "\\u", "slice_", "in_", "self_", "._", "target", "\\u", "seg", "\\u", "methods_", "._", "target_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "name", "\\u", "res_", "=_", "sct", "_", "._", "extract", "\\u", "fname_", "(_", "target", "\\u", "fname_", ")_", "[_", "1_", "]_", "+_", "'\\u", "gray", "matte", "rse", "g", "'_", "+_", "suffix_", "#", " ", "TOD", "O", ":", " ", "remove", " ", "suffix_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "res_", "._", "file", "\\u", "name_", "=_", "name", "\\u", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "res_", "._", "ext_", "=_", "'.", "ni", "i", ".", "gz", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "res_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", " ", " ", " ", " ", "save", "\\u", "image", "(", "self", ".", "res", "\\u", "GM", "\\u", "seg", ".", "data", ",", " ", "name", "\\u", "res", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "inv", "erse", "\\u", "wms", "eg", "\\u", "to", "\\u", "gm", "seg", "(", "self", ".", "res", "\\u", "GM", "\\u", "seg", ",", " ", "self", ".", "target", "\\u", "image", ",", " ", "name", "\\u", "res", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'", "Don", "e", "!", " ", "\\\\", "n", "To", " ", "see", " ", "the", " ", "result", ",", " ", "type", " ", ":'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'", "fs", "lv", "iew", " ", "'_", "+_", "target", "\\u", "fname_", "+_", "'", " ", "'_", "+_", "name", "\\u", "res_", "+_", "'.", "ni", "i", ".", "gz", " ", "-", "l", " ", "Red", " ", "-", "t", " ", "0.", "4", " ", "&'_", ",_", "gm", "\\u", "seg", "\\u", "param_", "._", "verbose_", ",_", "'", "info", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "GM", "seg", "Supervis", "ed", "Method_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "show_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Show", "ing", " ", "the", " ", "pca", " ", "mode", "s", " ", "...'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "model_", "._", "pca_", "._", "show", "\\u", "all", "\\u", "modes_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Plot", "ing", " ", "Ome", "ga", " ", "...'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "target", "\\u", "seg", "\\u", "methods_", "._", "plot", "\\u", "projected", "\\u", "dic_", "(_", "nb", "\\u", "modes_", "=_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Show", "ing", " ", "PCA", " ", "mode", " ", "graph", "s", " ", "...'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "model_", "._", "pca_", "._", "show", "\\u", "mode", "\\u", "variation_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "J", " ", ":'_", ",_", "self_", "._", "dictionary_", "._", "J_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", " ", " ", " ", " ", "sct", ".", "print", "v", "('\\", "\\", "n", "Show", "ing", " ", "the", " ", "projected", " ", "target", " ", "...", "')", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "target", "\\u", "seg", "\\u", "method", "s", ".", "show", "\\u", "projected", "\\u", "target", "()", "\\", "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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
joonty/vim-do/autoload/python/buffer.py
[ { "content": "import vim\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class VimBuffer:\n\n\n\n\n\n\n\n", "metadata": "root.VimBuffer", "header": "['module', '___EOS___']", "index": 2 }, { "content": " def __init__(self, buffer):\n self._buffer = buffer", "metadata": "root.VimBuffer.__init__", "header": "['class', 'VimBuffer', ':', '___EOS___']", "index": 3 }, { "content": " def replace(self, content):\n self._buffer[:] = content", "metadata": "root.VimBuffer.replace", "header": "['class', 'VimBuffer', ':', '___EOS___']", "index": 6 }, { "content": " def line(self, number):\n return self._buffer[number]", "metadata": "root.VimBuffer.line", "header": "['class', 'VimBuffer', ':', '___EOS___']", "index": 9 }, { "content": " def write(self, msg, overwrite):\n last_line = len(self._buffer)\n\n if isinstance(msg, list):\n to_write = msg\n else:\n to_write = str(msg).split('\\n')\n\n if len(to_write) == 1 and to_write[0] == \"\":\n return (last_line, last_line)\n\n if overwrite or self.is_empty():\n self._buffer[:] = to_write\n else:\n self._buffer.append(to_write)\n\n return (last_line, last_line + len(to_write))", "metadata": "root.VimBuffer.write", "header": "['class', 'VimBuffer', ':', '___EOS___']", "index": 12 }, { "content": " def overwrite(self, msg, lineno, allowEmpty):\n \"\"\" insert into current position in buffer\"\"\"\n if not msg and allowEmpty == False:\n return\n\n if isinstance(msg, list):\n to_write = msg\n else:\n to_write = str(msg).split('\\n')\n\n lstart = lineno - 1\n lend = lstart + len(to_write)\n self._buffer[lstart:lend] = to_write\n\n return (lstart, lend)", "metadata": "root.VimBuffer.overwrite", "header": "['class', 'VimBuffer', ':', '___EOS___']", "index": 30 }, { "content": " def delete(self, start_line, end_line = None):\n try:\n if not end_line:\n end_line = start_line + 1\n self._buffer[end_line]\n remaining_buffer = self._buffer[end_line:]\n del self._buffer[start_line:]\n self._buffer.append(remaining_buffer)\n except IndexError:\n del self._buffer[start_line:]", "metadata": "root.VimBuffer.delete", "header": "['class', 'VimBuffer', ':', '___EOS___']", "index": 46 }, { "content": " def contents(self):\n return self._buffer[:]", "metadata": "root.VimBuffer.contents", "header": "['class', 'VimBuffer', ':', '___EOS___']", "index": 57 }, { "content": " def clean(self):\n self._buffer[:] = []", "metadata": "root.VimBuffer.clean", "header": "['class', 'VimBuffer', ':', '___EOS___']", "index": 60 }, { "content": " def is_empty(self):\n if len(self._buffer) == 1 and len(self._buffer[0]) == 0:\n return True\n else:\n return False", "metadata": "root.VimBuffer.is_empty", "header": "['class', 'VimBuffer', ':', '___EOS___']", "index": 63 }, { "content": "class HiddenBuffer:\n\n\n\n\n\n\n\n", "metadata": "root.HiddenBuffer", "header": "['module', '___EOS___']", "index": 69 }, { "content": " def __init__(self, buffer = []):\n self._buffer = buffer[:]", "metadata": "root.HiddenBuffer.__init__", "header": "['class', 'HiddenBuffer', ':', '___EOS___']", "index": 70 }, { "content": " def line(self, number):\n return self._buffer[number]", "metadata": "root.HiddenBuffer.line", "header": "['class', 'HiddenBuffer', ':', '___EOS___']", "index": 73 }, { "content": " def replace(self, contents):\n self._buffer[:] = contents[:]", "metadata": "root.HiddenBuffer.replace", "header": "['class', 'HiddenBuffer', ':', '___EOS___']", "index": 76 }, { "content": " def write(self, msg, overwrite):\n last_line = len(self._buffer)\n\n if isinstance(msg, list):\n to_write = msg\n else:\n to_write = str(msg).split('\\n')\n\n if len(to_write) == 1 and to_write[0] == \"\":\n return (last_line, last_line)\n\n to_write = str(msg).split('\\n')\n\n if overwrite or self.is_empty():\n self._buffer[:] = to_write\n else:\n self._buffer.extend(to_write)\n\n return (last_line, last_line + len(to_write))", "metadata": "root.HiddenBuffer.write", "header": "['class', 'HiddenBuffer', ':', '___EOS___']", "index": 79 }, { "content": " def overwrite(self, msg, lineno, allowEmpty):\n \"\"\" insert into current position in buffer\"\"\"\n if not msg and allowEmpty == False:\n return\n\n if isinstance(msg, list):\n to_write = msg\n else:\n to_write = str(msg).split('\\n')\n last_line = len(self._buffer)\n\n lstart = lineno - 1\n lend = lstart + len(to_write)\n self._buffer[lstart:lend] = to_write\n\n return (lstart, lend)", "metadata": "root.HiddenBuffer.overwrite", "header": "['class', 'HiddenBuffer', ':', '___EOS___']", "index": 99 }, { "content": " def delete(self, start_line, end_line = None):\n try:\n if not end_line:\n end_line = start_line + 1\n self._buffer[start_line:end_line] = []\n except IndexError:\n del self._buffer[start_line:]", "metadata": "root.HiddenBuffer.delete", "header": "['class', 'HiddenBuffer', ':', '___EOS___']", "index": 116 }, { "content": " def clean(self):\n self._buffer[:] = []", "metadata": "root.HiddenBuffer.clean", "header": "['class', 'HiddenBuffer', ':', '___EOS___']", "index": 124 }, { "content": " def contents(self):\n return self._buffer[:]", "metadata": "root.HiddenBuffer.contents", "header": "['class', 'HiddenBuffer', ':', '___EOS___']", "index": 127 }, { "content": " def is_empty(self):\n return not self._buffer", "metadata": "root.HiddenBuffer.is_empty", "header": "['class', 'HiddenBuffer', ':', '___EOS___']", "index": 130 } ]
[ { "span": "import vim", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 10 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "vim_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Vi", "m", "Buffer_", ":_", "\\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_", "Vi", "m", "Buffer_", ":_", "\\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_", ",_", "buffer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "buffer_", "=_", "buffer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vi", "m", "Buffer_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "replace_", "(_", "self_", ",_", "content_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "buffer_", "[_", ":_", "]_", "=_", "content_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vi", "m", "Buffer_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "line_", "(_", "self_", ",_", "number_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "buffer_", "[_", "number_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vi", "m", "Buffer_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write_", "(_", "self_", ",_", "msg_", ",_", "overwrite_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "last", "\\u", "line_", "=_", "len_", "(_", "self_", "._", "\\u", "buffer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "msg_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "to", "\\u", "write_", "=_", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "to", "\\u", "write_", "=_", "str_", "(_", "msg_", ")_", "._", "split_", "(_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "to", "\\u", "write_", ")_", "==_", "1_", "and_", "to", "\\u", "write_", "[_", "0_", "]_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "last", "\\u", "line_", ",_", "last", "\\u", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "overwrite_", "or_", "self_", "._", "is", "\\u", "empty_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "buffer_", "[_", ":_", "]_", "=_", "to", "\\u", "write_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "buffer_", "._", "append_", "(_", "to", "\\u", "write_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "last", "\\u", "line_", ",_", "last", "\\u", "line_", "+_", "len_", "(_", "to", "\\u", "write_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vi", "m", "Buffer_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "overwrite_", "(_", "self_", ",_", "msg_", ",_", "lineno_", ",_", "allow", "Empty_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "insert", " ", "int", "o", " ", "current", " ", "position", " ", "in", " ", "buffer", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "msg_", "and_", "allow", "Empty_", "==_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "msg_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "to", "\\u", "write_", "=_", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "to", "\\u", "write_", "=_", "str_", "(_", "msg_", ")_", "._", "split_", "(_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lsta", "rt_", "=_", "lineno_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lend", "_", "=_", "lsta", "rt_", "+_", "len_", "(_", "to", "\\u", "write_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "buffer_", "[_", "lsta", "rt_", ":_", "lend", "_", "]_", "=_", "to", "\\u", "write_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "(_", "lsta", "rt_", ",_", "lend", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vi", "m", "Buffer_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete_", "(_", "self_", ",_", "start", "\\u", "line_", ",_", "end", "\\u", "line_", "=_", "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_", "not_", "end", "\\u", "line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "end", "\\u", "line_", "=_", "start", "\\u", "line_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "buffer_", "[_", "end", "\\u", "line_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rema", "inin", "g", "\\u", "buffer_", "=_", "self_", "._", "\\u", "buffer_", "[_", "end", "\\u", "line_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "self_", "._", "\\u", "buffer_", "[_", "start", "\\u", "line_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "buffer_", "._", "append_", "(_", "rema", "inin", "g", "\\u", "buffer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Index", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "self_", "._", "\\u", "buffer_", "[_", "start", "\\u", "line_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vi", "m", "Buffer_", ":_", "\\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 ", " _", "return_", "self_", "._", "\\u", "buffer_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vi", "m", "Buffer_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clean_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "buffer_", "[_", ":_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vi", "m", "Buffer_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "empty_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "self_", "._", "\\u", "buffer_", ")_", "==_", "1_", "and_", "len_", "(_", "self_", "._", "\\u", "buffer_", "[_", "0_", "]_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Hi", "dde", "n", "Buffer_", ":_", "\\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_", "Hi", "dde", "n", "Buffer_", ":_", "\\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_", ",_", "buffer_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "buffer_", "=_", "buffer_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hi", "dde", "n", "Buffer_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "line_", "(_", "self_", ",_", "number_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "buffer_", "[_", "number_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hi", "dde", "n", "Buffer_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "replace_", "(_", "self_", ",_", "contents_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "buffer_", "[_", ":_", "]_", "=_", "contents_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hi", "dde", "n", "Buffer_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write_", "(_", "self_", ",_", "msg_", ",_", "overwrite_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "last", "\\u", "line_", "=_", "len_", "(_", "self_", "._", "\\u", "buffer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "msg_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "to", "\\u", "write_", "=_", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "to", "\\u", "write_", "=_", "str_", "(_", "msg_", ")_", "._", "split_", "(_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "to", "\\u", "write_", ")_", "==_", "1_", "and_", "to", "\\u", "write_", "[_", "0_", "]_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "last", "\\u", "line_", ",_", "last", "\\u", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "to", "\\u", "write_", "=_", "str_", "(_", "msg_", ")_", "._", "split_", "(_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "overwrite_", "or_", "self_", "._", "is", "\\u", "empty_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "buffer_", "[_", ":_", "]_", "=_", "to", "\\u", "write_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "buffer_", "._", "extend_", "(_", "to", "\\u", "write_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "last", "\\u", "line_", ",_", "last", "\\u", "line_", "+_", "len_", "(_", "to", "\\u", "write_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hi", "dde", "n", "Buffer_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "overwrite_", "(_", "self_", ",_", "msg_", ",_", "lineno_", ",_", "allow", "Empty_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "insert", " ", "int", "o", " ", "current", " ", "position", " ", "in", " ", "buffer", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "msg_", "and_", "allow", "Empty_", "==_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "msg_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "to", "\\u", "write_", "=_", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "to", "\\u", "write_", "=_", "str_", "(_", "msg_", ")_", "._", "split_", "(_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "last", "\\u", "line_", "=_", "len_", "(_", "self_", "._", "\\u", "buffer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lsta", "rt_", "=_", "lineno_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lend", "_", "=_", "lsta", "rt_", "+_", "len_", "(_", "to", "\\u", "write_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "buffer_", "[_", "lsta", "rt_", ":_", "lend", "_", "]_", "=_", "to", "\\u", "write_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "(_", "lsta", "rt_", ",_", "lend", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hi", "dde", "n", "Buffer_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete_", "(_", "self_", ",_", "start", "\\u", "line_", ",_", "end", "\\u", "line_", "=_", "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_", "not_", "end", "\\u", "line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "end", "\\u", "line_", "=_", "start", "\\u", "line_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "buffer_", "[_", "start", "\\u", "line_", ":_", "end", "\\u", "line_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Index", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "self_", "._", "\\u", "buffer_", "[_", "start", "\\u", "line_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hi", "dde", "n", "Buffer_", ":_", "\\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_", "clean_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "buffer_", "[_", ":_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hi", "dde", "n", "Buffer_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "contents_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "buffer_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hi", "dde", "n", "Buffer_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "empty_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "not_", "self_", "._", "\\u", "buffer_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 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, 4, 2, 2, 2, 2, 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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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 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 ]
Except block handles 'BaseException'
kergoth/git-origin/git-python/lib/git/tree.py
[ { "content": " @staticmethod\n def content_from_string(repo, text):\n \"\"\"\n Parse a content item and create the appropriate object\n\n ``repo``\n is the Repo\n\n ``text``\n is the single line containing the items data in `git ls-tree` format\n\n Returns\n ``git.Blob`` or ``git.Tree``\n \"\"\"\n try:\n mode, typ, id, name = text.expandtabs(1).split(\" \", 3)\n except:\n return None\n\n if typ == \"tree\":\n return Tree(repo, id=id, mode=mode, name=name)\n elif typ == \"blob\":\n return blob.Blob(repo, id=id, mode=mode, name=name)\n elif typ == \"commit\":\n return None\n else:\n raise(TypeError, \"Invalid type: %s\" % typ)", "metadata": "root.Tree.content_from_string", "header": "['class', 'Tree', '(', 'LazyMixin', ')', ':', '___EOS___']", "index": 32 } ]
[ { "span": "except:", "start_line": 48, "start_column": 8, "end_line": 48, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Tree_", "(_", "La", "zy", "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_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "content", "\\u", "from", "\\u", "string_", "(_", "repo_", ",_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Pars", "e", " ", "a", " ", "content", " ", "item", " ", "and", " ", "create", " ", "the", " ", "appropr", "iate", " ", "object", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "``", "repo", "``", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "the", " ", "Rep", "o", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", " ", "``", "text", "``", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "the", " ", "single", " ", "line", " ", "contain", "ing", " ", "the", " ", "items", " ", "data", " ", "in", " ", "`", "git", " ", "ls", "-", "tree", "`", " ", "format", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "``", "git", ".", "Blo", "b", "``", " ", "or", " ", "``", "git", ".", "Tree", "``", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mode_", ",_", "typ_", ",_", "id_", ",_", "name_", "=_", "text_", "._", "expand", "tabs_", "(_", "1_", ")_", "._", "split_", "(_", "\"", " ", "\"_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "typ_", "==_", "\"", "tree", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Tree_", "(_", "repo_", ",_", "id_", "=_", "id_", ",_", "mode_", "=_", "mode_", ",_", "name_", "=_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "typ_", "==_", "\"", "blob", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "blob_", "._", "Blob_", "(_", "repo_", ",_", "id_", "=_", "id_", ",_", "mode_", "=_", "mode_", ",_", "name_", "=_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "typ_", "==_", "\"", "commit", "\"_", ":_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "(_", "Type", "Error_", ",_", "\"", "Inva",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2, 2, 2, 2, 2, 2, 2, 2 ]
Testing equality to None
kdart/pycopia/core/pycopia/fsm.py
[ { "content": " def set_default_transition(self, action, next_state):\n '''This sets the default transition.\n If the FSM cannot match the pair (input_symbol, current_state)\n in the transition table then this is the transition that\n will be returned. This is useful for catching errors and undefined states.\n The default transition can be removed by calling\n `add_default_transition (None, None)`.\n If the default is not set and the FSM cannot match\n the input_symbol and current_state then it will\n raise an exception (see process()).\n '''\n if action == None and next_state == None:\n self.default_transition = None\n else:\n self.default_transition = (action, next_state)", "metadata": "root.FSM.set_default_transition", "header": "['class', 'FSM', '(', 'object', ')', ':', '___EOS___']", "index": 92 } ]
[ { "span": "action == None ", "start_line": 103, "start_column": 11, "end_line": 103, "end_column": 25 }, { "span": "next_state == None:", "start_line": 103, "start_column": 30, "end_line": 103, "end_column": 48 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "FSM", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "default", "\\u", "transition_", "(_", "self_", ",_", "action_", ",_", "next", "\\u", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Thi", "s", " ", "sets", " ", "the", " ", "default", " ", "transiti", "on", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "the", " ", "FSM", " ", "cann", "ot", " ", "match", " ", "the", " ", "pair", " ", "(", "input", "\\u", "symbol", ",", " ", "current", "\\u", "state", ")", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "the", " ", "transiti", "on", " ", "table", " ", "then", " ", "this", " ", "is", " ", "the", " ", "transiti", "on", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "will", " ", "be", " ", "return", "ed", ".", " ", "Thi", "s", " ", "is", " ", "usef", "ul", " ", "for", " ", "catch", "ing", " ", "error", "s", " ", "and", " ", "undefined", " ", "state", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "default", " ", "transiti", "on", " ", "can", " ", "be", " ", "remove", "d", " ", "by", " ", "calling", "\\", "10", ";", " ", " ", " ", " ", "`", "add", "\\u", "default", "\\u", "transiti", "on", " ", "(", "Non", "e", ",", " ", "Non", "e", ")`", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "the", " ", "default", " ", "is", " ", "not", " ", "set", " ", "and", " ", "the", " ", "FSM", " ", "cann", "ot", " ", "match", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "input", "\\u", "symbol", " ", "and", " ", "current", "\\u", "state", " ", "then", " ", "it", " ", "will", "\\", "10", ";", " ", " ", " ", " ", "raise", " ", "an", " ", "exception", " ", "(", "see", " ", "process", "())", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "action_", "==_", "None_", "and_", "next", "\\u", "state_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "default", "\\u", "transition_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "default", "\\u", "transition_", "=_", "(_", "action_", ",_", "next", "\\u", "state_", ")_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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 ]
Unused import
godaddy/Thespian/thespian/test/testActors.py
[ { "content": "\"\"\"This test creates two top level actors and one sub-actor and\n verifies that the actors can exchange sequences of messages.\"\"\"\n\nimport unittest\nimport time\nimport thespian.test.helpers\nfrom thespian.actors import *\nfrom thespian.test import ActorSystemTestCase\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class rosaline(Actor):\n name = 'Rosaline'", "metadata": "root.rosaline", "header": "['module', '___EOS___']", "index": 9 }, { "content": "class Romeo(Actor):", "metadata": "root.Romeo", "header": "['module', '___EOS___']", "index": 12 }, { "content": " def receiveMessage(self, msg, sender):\n if isinstance(msg, JulietAppears):\n self.send(msg.juliet, \"But, soft! what light through yonder window breaks?\")\n elif isinstance(msg, ActorExitRequest):\n pass # nothing special, just die\n elif msg == 'Ay me!':\n self.send(sender, 'She speaks!')\n elif msg == 'O Romeo, Romeo! wherefore art thou Romeo?':\n self.send(sender, 'Shall I hear more, or shall I speak at this?')\n elif 'rose' in msg:\n pass # wait for it\n elif 'sweet' in msg:\n self.send(sender, 'Like softest music to attending ears!')\n elif 'hello' in msg:\n print('Hello from %s'%(str(self)))\n elif 'who_are_you' == msg:\n self.send(sender, self.myAddress)\n # otherwise sit and swoon", "metadata": "root.Romeo.receiveMessage", "header": "['class', 'Romeo', '(', 'Actor', ')', ':', '___EOS___']", "index": 13 }, { "content": "class Capulet(Actor):", "metadata": "root.Capulet", "header": "['module', '___EOS___']", "index": 33 }, { "content": " def receiveMessage(self, msg, sender):\n if msg == \"has a daughter?\":\n self.send(sender, self.createActor(Juliet))", "metadata": "root.Capulet.receiveMessage", "header": "['class', 'Capulet', '(', 'Actor', ')', ':', '___EOS___']", "index": 34 }, { "content": "class Juliet(Actor):", "metadata": "root.Juliet", "header": "['module', '___EOS___']", "index": 39 }, { "content": " def __init__(self, *args, **kw):\n self.nurse = None\n self.recalled = False\n super(Juliet, self).__init__(*args, **kw)", "metadata": "root.Juliet.__init__", "header": "['class', 'Juliet', '(', 'Actor', ')', ':', '___EOS___']", "index": 40 }, { "content": " def receiveMessage(self, msg, sender):\n if isinstance(msg, ActorExitRequest):\n pass # nothing special, just die\n elif \"what light\" in msg:\n self.send(sender, 'Ay me!')\n elif msg == 'She speaks!':\n self.send(sender, 'O Romeo, Romeo! wherefore art thou Romeo?')\n elif msg == 'Shall I hear more, or shall I speak at this?':\n self.send(sender, \"What's in a name? That which we call a rose\")\n self.send(sender, \"By any other name would smell as sweet\")\n elif msg == 'Like softest music to attending ears!':\n if self.nurse:\n self.send(self.nurse, 'Anon, good nurse!')\n else:\n self.recalled = True\n elif msg == 'Mistress!':\n self.nurse = sender\n if self.recalled:\n self.send(self.nurse, 'Anon, good nurse!')\n elif 'who_are_you' == msg:\n self.send(sender, self.myAddress)", "metadata": "root.Juliet.receiveMessage", "header": "['class', 'Juliet', '(', 'Actor', ')', ':', '___EOS___']", "index": 44 }, { "content": "class Nurse(Actor):", "metadata": "root.Nurse", "header": "['module', '___EOS___']", "index": 67 }, { "content": " def __init__(self, *args, **kw):\n self.heardItAll = False\n super(Nurse, self).__init__(*args, **kw)", "metadata": "root.Nurse.__init__", "header": "['class', 'Nurse', '(', 'Actor', ')', ':', '___EOS___']", "index": 68 }, { "content": " def receiveMessage(self, msg, sender):\n if type(msg) == type((1,2)) and msg[0] == 'begin':\n self.send(msg[1], JulietAppears(msg[2]))\n self.send(msg[2], 'Mistress!')\n elif msg == 'Anon, good nurse!':\n self.heardItAll = True\n elif msg == 'done?':\n self.send(sender, 'Fini' if self.heardItAll else 'not yet')", "metadata": "root.Nurse.receiveMessage", "header": "['class', 'Nurse', '(', 'Actor', ')', ':', '___EOS___']", "index": 71 }, { "content": "class JulietAppears:\n stage = 'Right'", "metadata": "root.JulietAppears", "header": "['module', '___EOS___']", "index": 81 }, { "content": " def __init__(self, julietAddr):\n self.juliet = julietAddr", "metadata": "root.JulietAppears.__init__", "header": "['class', 'JulietAppears', ':', '___EOS___']", "index": 83 }, { "content": "class TestASimpleSystem(ActorSystemTestCase):\n testbase='Simple'\n scope='func'\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.TestASimpleSystem", "header": "['module', '___EOS___']", "index": 87 }, { "content": " def test01_ActorSystemStartupShutdown(self):\n rosalineA = ActorSystem().createActor(rosaline)\n # just finish, make sure no exception is thrown.", "metadata": "root.TestASimpleSystem.test01_ActorSystemStartupShutdown", "header": "['class', 'TestASimpleSystem', '(', 'ActorSystemTestCase', ')', ':', '___EOS___']", "index": 91 }, { "content": " def test01_1_ActorSystemMultipleShutdown(self):\n rosalineA = ActorSystem().createActor(rosaline)\n ActorSystem().shutdown()\n ActorSystem().shutdown()", "metadata": "root.TestASimpleSystem.test01_1_ActorSystemMultipleShutdown", "header": "['class', 'TestASimpleSystem', '(', 'ActorSystemTestCase', ')', ':', '___EOS___']", "index": 95 }, { "content": " def test02_PrimaryActorCreation(self):\n romeo = ActorSystem().createActor(Romeo)\n juliet = ActorSystem().createActor(Juliet)\n self.assertNotEqual(romeo, juliet)", "metadata": "root.TestASimpleSystem.test02_PrimaryActorCreation", "header": "['class', 'TestASimpleSystem', '(', 'ActorSystemTestCase', ')', ':', '___EOS___']", "index": 100 }, { "content": " def test03_CreateActorUniqueAddress(self):\n romeo = ActorSystem().createActor(Romeo)\n juliet = ActorSystem().createActor(Juliet)\n self.assertNotEqual(romeo, juliet)\n romeo2 = ActorSystem().createActor(Romeo)\n self.assertNotEqual(romeo, romeo2)", "metadata": "root.TestASimpleSystem.test03_CreateActorUniqueAddress", "header": "['class', 'TestASimpleSystem', '(', 'ActorSystemTestCase', ')', ':', '___EOS___']", "index": 105 }, { "content": " def NOtest04_PossibleActorSystemResourceExhaustion(self):\n asys = ActorSystem()\n try:\n addresses = [asys.createActor(Juliet) for n in range(10000)]\n except OSError as err:\n import errno\n if err.errno == errno.EGAIN:\n pass\n else:\n raise", "metadata": "root.TestASimpleSystem.NOtest04_PossibleActorSystemResourceExhaustion", "header": "['class', 'TestASimpleSystem', '(', 'ActorSystemTestCase', ')', ':', '___EOS___']", "index": 112 }, { "content": " def test05_ManyActorsUniqueAddress(self):\n asys = ActorSystem()\n addresses = [asys.createActor(Juliet) for n in range(100)]\n uniqueAddresses = set(addresses)\n if len(addresses) != len(uniqueAddresses):\n duplicates = [A for A in uniqueAddresses if len([X for X in addresses if X == A]) > 1]\n print('Duplicates: %s'%map(str, duplicates))\n if duplicates:\n for each in duplicates:\n print('... %s at: %s'%(str(each), str([N for N,A in enumerate(addresses) if A == each])))\n print('Note: if this is a UDPTransport test, be advised that Linux occasionally does seem to assign the same UDP port multiple times. Linux bug?')\n self.assertEqual(len(addresses), len(uniqueAddresses))", "metadata": "root.TestASimpleSystem.test05_ManyActorsUniqueAddress", "header": "['class', 'TestASimpleSystem', '(', 'ActorSystemTestCase', ')', ':', '___EOS___']", "index": 124 }, { "content": " def test06_ManyActorsValidAddresses(self):\n import string\n addresses = [ActorSystem().createActor(Juliet) for n in range(100)]\n for addr in addresses:\n invchar = ''.join([c for c in str(addr)\n if c not in string.ascii_letters + string.digits + \"-~/():., '|\"])\n self.assertEqual(str(addr), str(addr) + invchar) # invchar should be blank", "metadata": "root.TestASimpleSystem.test06_ManyActorsValidAddresses", "header": "['class', 'TestASimpleSystem', '(', 'ActorSystemTestCase', ')', ':', '___EOS___']", "index": 137 }, { "content": " def test07_SingleNonListeningActorTell(self):\n rosalineA = ActorSystem().createActor(rosaline)\n # rosaline does not override the receiveMessage method, so the\n # Actor default method will throw an exception. This will\n # Kill the rosaline Actor. It's a top level Actor, so it will\n # not be restarted. This will cause the 'hello' message to be\n # delivered to the DeadLetterBox. Verify that no exception\n # makes its way out of the ActorSystem here.\n ActorSystem().tell(rosalineA, 'hello')\n self.assertTrue(True)", "metadata": "root.TestASimpleSystem.test07_SingleNonListeningActorTell", "header": "['class', 'TestASimpleSystem', '(', 'ActorSystemTestCase', ')', ':', '___EOS___']", "index": 145 }, { "content": " def test08_SingleActorTell(self):\n romeoA = ActorSystem().createActor(Romeo)\n ActorSystem().tell(romeoA, 'hello')\n # Nothing much happens, Romeo is smitten and has no time for trivialities, but\n # he will try to generate str() of himself.", "metadata": "root.TestASimpleSystem.test08_SingleActorTell", "header": "['class', 'TestASimpleSystem', '(', 'ActorSystemTestCase', ')', ':', '___EOS___']", "index": 156 }, { "content": " def test09_SingleActorAsk(self):\n romeoA = ActorSystem().createActor(Romeo)\n resp = ActorSystem().ask(romeoA, 'O Romeo, Romeo! wherefore art thou Romeo?')\n self.assertEqual(resp, 'Shall I hear more, or shall I speak at this?')", "metadata": "root.TestASimpleSystem.test09_SingleActorAsk", "header": "['class', 'TestASimpleSystem', '(', 'ActorSystemTestCase', ')', ':', '___EOS___']", "index": 162 }, { "content": " def test10_ActorAskWithNoResponse(self):\n romeoA = ActorSystem().createActor(Romeo)\n # This test is possibly unique to the simpleSystemBase, which\n # will run an process all messages on an ask (or tell) call.\n # Properly there is no way to determine if an answer is\n # forthcoming from an asynchronous system, so all this can do\n # is assert that there is no response within a particular time\n # period. At this point, timing is not supported, so this\n # test is underspecified and assumptive.\n resp = ActorSystem().ask(romeoA, \"What's in a name? That which we call a rose\", 1.5)\n self.assertEqual(resp, None)\n # Now verify that the Actor and system are still alive and operating normally.\n resp = ActorSystem().ask(romeoA, 'O Romeo, Romeo! wherefore art thou Romeo?')\n self.assertEqual(resp, 'Shall I hear more, or shall I speak at this?')", "metadata": "root.TestASimpleSystem.test10_ActorAskWithNoResponse", "header": "['class', 'TestASimpleSystem', '(', 'ActorSystemTestCase', ')', ':', '___EOS___']", "index": 167 }, { "content": " def test11_SingleActorAskMultipleTimes(self):\n romeoA = ActorSystem().createActor(Romeo)\n self.assertEqual(ActorSystem().ask(romeoA, 'O Romeo, Romeo! wherefore art thou Romeo?'),\n 'Shall I hear more, or shall I speak at this?')\n self.assertEqual(ActorSystem().ask(romeoA, 'O Romeo, Romeo! wherefore art thou Romeo?'),\n 'Shall I hear more, or shall I speak at this?')\n self.assertEqual(ActorSystem().ask(romeoA, 'Ay me!'), 'She speaks!')\n self.assertEqual(ActorSystem().ask(romeoA, 'O Romeo, Romeo! wherefore art thou Romeo?'),\n 'Shall I hear more, or shall I speak at this?')", "metadata": "root.TestASimpleSystem.test11_SingleActorAskMultipleTimes", "header": "['class', 'TestASimpleSystem', '(', 'ActorSystemTestCase', ')', ':', '___EOS___']", "index": 182 }, { "content": " def test12_MultipleActorsAskMultipleTimes(self):\n play = ActorSystem()\n romeo = play.createActor(Romeo)\n self.assertEqual(play.ask(romeo, 'O Romeo, Romeo! wherefore art thou Romeo?'),\n 'Shall I hear more, or shall I speak at this?')\n juliet = play.createActor(Juliet)\n self.assertEqual(play.ask(romeo, 'O Romeo, Romeo! wherefore art thou Romeo?'),\n 'Shall I hear more, or shall I speak at this?')\n self.assertEqual(play.ask(romeo, 'Ay me!'), 'She speaks!')\n self.assertEqual(play.ask(juliet, 'She speaks!'),\n 'O Romeo, Romeo! wherefore art thou Romeo?')\n self.assertEqual(play.ask(romeo, 'Ay me!'), 'She speaks!')\n self.assertEqual(play.ask(juliet, \"Do you know what light that is?\"), 'Ay me!')", "metadata": "root.TestASimpleSystem.test12_MultipleActorsAskMultipleTimes", "header": "['class', 'TestASimpleSystem', '(', 'ActorSystemTestCase', ')', ':', '___EOS___']", "index": 192 }, { "content": " def test13_SubActorCreation(self):\n capulet = ActorSystem().createActor(Capulet)\n juliet = ActorSystem().ask(capulet, 'has a daughter?', 2.5)\n print ('Juliet is: %s'%str(juliet))\n self.assertIsNot(juliet, None)\n if juliet:\n self.assertEqual(ActorSystem().ask(juliet, 'what light?'), 'Ay me!', 0.75)\n juliet2 = ActorSystem().ask(capulet, 'has a daughter?')\n self.assertIsNot(juliet2, None)\n if juliet2:\n self.assertEqual(ActorSystem().ask(juliet2, 'what light?'), 'Ay me!', 0.5)\n self.assertEqual(ActorSystem().ask(juliet, 'what light?'), 'Ay me!', 0.5)", "metadata": "root.TestASimpleSystem.test13_SubActorCreation", "header": "['class', 'TestASimpleSystem', '(', 'ActorSystemTestCase', ')', ':', '___EOS___']", "index": 206 }, { "content": " def test14_EntireActWithActorStart(self):\n play = ActorSystem()\n romeo = play.createActor(Romeo)\n juliet = play.createActor(Juliet)\n nurse = play.createActor(Nurse)\n self.assertEqual(play.ask(nurse, 'done?'), 'not yet')\n play.tell(nurse, ('begin', romeo, juliet))\n\n for X in range(50):\n if play.ask(nurse, 'done?') == 'Fini':\n break\n time.sleep(0.01) # Allow some time for the entire act\n self.assertEqual(play.ask(nurse, 'done?'), 'Fini')", "metadata": "root.TestASimpleSystem.test14_EntireActWithActorStart", "header": "['class', 'TestASimpleSystem', '(', 'ActorSystemTestCase', ')', ':', '___EOS___']", "index": 219 }, { "content": " def test15_IncompleteActMissingActor(self):\n play = ActorSystem()\n romeo = play.createActor(Romeo)\n juliet = play.createActor(Juliet)\n # no nurse actor created\n play.tell(romeo, JulietAppears(juliet))\n # No error should occur here when Juliet reaches the end and\n # doesn't have a nurse to tell.\n\n time.sleep(0.5) # Allow some time for the entire act\n\n # Now create the nurse and tell her to talk to romeo and\n # juliet, which should cause completion\n nurse = play.createActor(Nurse)\n self.assertEqual(play.ask(nurse, 'done?'), 'not yet')\n play.tell(nurse, ('begin', romeo, juliet))\n\n for X in range(50):\n if play.ask(nurse, 'done?') == 'Fini':\n break\n time.sleep(0.01) # Allow some time for the entire act\n self.assertEqual(play.ask(nurse, 'done?'), 'Fini')", "metadata": "root.TestASimpleSystem.test15_IncompleteActMissingActor", "header": "['class', 'TestASimpleSystem', '(', 'ActorSystemTestCase', ')', ':', '___EOS___']", "index": 233 }, { "content": " def test16_ActorProperties(self):\n play = ActorSystem()\n romeo = play.createActor(Romeo)\n juliet = play.createActor(Juliet)\n\n self.assertIsNotNone(play.ask(romeo, 'who_are_you', 0.25))\n self.assertIsNotNone(play.ask(juliet, 'who_are_you', 0.25))\n self.assertNotEqual(play.ask(romeo, 'who_are_you', 0.25),\n play.ask(juliet, 'who_are_you', 0.25))", "metadata": "root.TestASimpleSystem.test16_ActorProperties", "header": "['class', 'TestASimpleSystem', '(', 'ActorSystemTestCase', ')', ':', '___EOS___']", "index": 256 }, { "content": "class TestMultiprocUDPSystem(TestASimpleSystem):\n testbase='MultiprocUDP'", "metadata": "root.TestMultiprocUDPSystem", "header": "['module', '___EOS___']", "index": 267 }, { "content": " def setUp(self):\n self.setSystemBase('multiprocUDPBase')\n super(TestMultiprocUDPSystem, self).setUp()", "metadata": "root.TestMultiprocUDPSystem.setUp", "header": "['class', 'TestMultiprocUDPSystem', '(', 'TestASimpleSystem', ')', ':', '___EOS___']", "index": 269 }, { "content": "class TestMultiprocTCPSystem(TestASimpleSystem):\n testbase='MultiprocTCP'", "metadata": "root.TestMultiprocTCPSystem", "header": "['module', '___EOS___']", "index": 273 }, { "content": " def setUp(self):\n self.setSystemBase('multiprocTCPBase')\n super(TestMultiprocTCPSystem, self).setUp()", "metadata": "root.TestMultiprocTCPSystem.setUp", "header": "['class', 'TestMultiprocTCPSystem', '(', 'TestASimpleSystem', ')', ':', '___EOS___']", "index": 275 }, { "content": "class TestMultiprocQueueSystem(TestASimpleSystem):\n testbase='MultiprocQueue'", "metadata": "root.TestMultiprocQueueSystem", "header": "['module', '___EOS___']", "index": 279 }, { "content": " def setUp(self):\n self.setSystemBase('multiprocQueueBase')\n super(TestMultiprocQueueSystem, self).setUp()", "metadata": "root.TestMultiprocQueueSystem.setUp", "header": "['class', 'TestMultiprocQueueSystem', '(', 'TestASimpleSystem', ')', ':', '___EOS___']", "index": 281 } ]
[ { "span": "import unittest", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 15 }, { "span": "import thespian.test.helpers", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 28 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "Thi", "s", " ", "test", " ", "create", "s", " ", "two", " ", "top", " ", "level", " ", "actors", " ", "and", " ", "one", " ", "sub", "-", "actor", " ", "and", "\\", "10", ";", " ", " ", " ", "verifie", "s", " ", "tha", "t", " ", "the", " ", "actors", " ", "can", " ", "exchange", " ", "sequence", "s", " ", "of", " ", "message", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "thes", "pian", "_", "._", "test_", "._", "helpers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "thes", "pian", "_", "._", "actors_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "thes", "pian", "_", "._", "test_", "import_", "Act", "or", "System", "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\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "ros", "alin", "e_", "(_", "Actor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "'", "Ros", "alin", "e", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Rom", "eo_", "(_", "Actor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rom", "eo_", "(_", "Actor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "receive", "Message_", "(_", "self_", ",_", "msg_", ",_", "sender_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "msg_", ",_", "Juli", "et", "App", "ear", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "send_", "(_", "msg_", "._", "jul", "iet", "_", ",_", "\"", "Bu", "t", ",", " ", "soft", "!", " ", "what", " ", "light", " ", "through", " ", "yon", "der", " ", "window", " ", "breaks", "?\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "msg_", ",_", "Act", "or", "Exi", "t", "Request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "#", " ", "not", "hing", " ", "special", ",", " ", "just", " ", "die_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "msg_", "==_", "'", "Ay", " ", "me", "!'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "send_", "(_", "sender_", ",_", "'", "She", " ", "speak", "s", "!'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "msg_", "==_", "'", "O", " ", "Rom", "eo", ",", " ", "Rom", "eo", "!", " ", "where", "fore", " ", "art", " ", "tho", "u", " ", "Rom", "eo", "?'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "send_", "(_", "sender_", ",_", "'", "Sha", "ll", " ", "I", " ", "hear", " ", "more", ",", " ", "or", " ", "sha", "ll", " ", "I", " ", "speak", " ", "at", " ", "this", "?'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "rose", "'_", "in_", "msg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "#", " ", "wait", " ", "for", " ", "it_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "swe", "et", "'_", "in_", "msg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "send_", "(_", "sender_", ",_", "'", "Lik", "e", " ", "soft", "est", " ", "music", " ", "to", " ", "attend", "ing", " ", "ear", "s", "!'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "hell", "o", "'_", "in_", "msg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "Hell", "o", " ", "from", " ", "%", "s", "'_", "%_", "(_", "str_", "(_", "self_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "who", "\\u", "are", "\\u", "you", "'_", "==_", "msg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "send_", "(_", "sender_", ",_", "self_", "._", "my", "Address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "other", "wis", "e", " ", "sit", " ", "and", " ", "sw", "oon", "_", "\\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_", "class_", "Cap", "ule", "t_", "(_", "Actor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cap", "ule", "t_", "(_", "Actor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "receive", "Message_", "(_", "self_", ",_", "msg_", ",_", "sender_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "msg_", "==_", "\"", "has", " ", "a", " ", "dau", "ghte", "r", "?\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "send_", "(_", "sender_", ",_", "self_", "._", "create", "Actor_", "(_", "Juli", "et_", ")_", ")_", "\\u\\u\\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_", "Juli", "et_", "(_", "Actor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Juli", "et_", "(_", "Actor_", ")_", ":_", "\\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_", ",_", "*_", "args_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "nur", "se_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "reca", "lle", "d_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Juli", "et_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Juli", "et_", "(_", "Actor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "receive", "Message_", "(_", "self_", ",_", "msg_", ",_", "sender_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "msg_", ",_", "Act", "or", "Exi", "t", "Request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "#", " ", "not", "hing", " ", "special", ",", " ", "just", " ", "die_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\"", "what", " ", "light", "\"_", "in_", "msg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "send_", "(_", "sender_", ",_", "'", "Ay", " ", "me", "!'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "msg_", "==_", "'", "She", " ", "speak", "s", "!'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "send_", "(_", "sender_", ",_", "'", "O", " ", "Rom", "eo", ",", " ", "Rom", "eo", "!", " ", "where", "fore", " ", "art", " ", "tho", "u", " ", "Rom", "eo", "?'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "msg_", "==_", "'", "Sha", "ll", " ", "I", " ", "hear", " ", "more", ",", " ", "or", " ", "sha", "ll", " ", "I", " ", "speak", " ", "at", " ", "this", "?'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "send_", "(_", "sender_", ",_", "\"", "What", "'", "s", " ", "in", " ", "a", " ", "name", "?", " ", "Tha", "t", " ", "whi", "ch", " ", "we", " ", "call", " ", "a", " ", "rose", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send_", "(_", "sender_", ",_", "\"", "By", " ", "any", " ", "other", " ", "name", " ", "wou", "ld", " ", "sme", "ll", " ", "as", " ", "swe", "et", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "msg_", "==_", "'", "Lik", "e", " ", "soft", "est", " ", "music", " ", "to", " ", "attend", "ing", " ", "ear", "s", "!'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "nur", "se_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "send_", "(_", "self_", "._", "nur", "se_", ",_", "'", "Ano", "n", ",", " ", "good", " ", "nur", "se", "!'_", ")_", "\\u\\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_", "._", "reca", "lle", "d_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "msg_", "==_", "'", "Mis", "tres", "s", "!'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "nur", "se_", "=_", "sender_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "reca", "lle", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "send_", "(_", "self_", "._", "nur", "se_", ",_", "'", "Ano", "n", ",", " ", "good", " ", "nur", "se", "!'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "who", "\\u", "are", "\\u", "you", "'_", "==_", "msg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "send_", "(_", "sender_", ",_", "self_", "._", "my", "Address_", ")_", "\\u\\u\\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_", "Nu", "rse", "_", "(_", "Actor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Nu", "rse", "_", "(_", "Actor_", ")_", ":_", "\\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_", ",_", "*_", "args_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "hear", "d", "It", "All_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Nu", "rse", "_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Nu", "rse", "_", "(_", "Actor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "receive", "Message_", "(_", "self_", ",_", "msg_", ",_", "sender_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "type_", "(_", "msg_", ")_", "==_", "type_", "(_", "(_", "1_", ",_", "2_", ")_", ")_", "and_", "msg_", "[_", "0_", "]_", "==_", "'", "begin", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "send_", "(_", "msg_", "[_", "1_", "]_", ",_", "Juli", "et", "App", "ear", "s_", "(_", "msg_", "[_", "2_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send_", "(_", "msg_", "[_", "2_", "]_", ",_", "'", "Mis", "tres", "s", "!'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "msg_", "==_", "'", "Ano", "n", ",", " ", "good", " ", "nur", "se", "!'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "hear", "d", "It", "All_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "msg_", "==_", "'", "don", "e", "?'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "send_", "(_", "sender_", ",_", "'", "Fini", "'_", "if_", "self_", "._", "hear", "d", "It", "All_", "else_", "'", "not", " ", "ye", "t", "'_", ")_", "\\u\\u\\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_", "Juli", "et", "App", "ear", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stage_", "=_", "'", "Rig", "ht", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Juli", "et", "App", "ear", "s_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "jul", "iet", "Addr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "jul", "iet", "_", "=_", "jul", "iet", "Addr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "AS", "impl", "e", "System_", "(_", "Act", "or", "System", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "testb", "ase_", "=_", "'", "Simple", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scope_", "=_", "'", "func", "'_", "\\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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "AS", "impl", "e", "System_", "(_", "Act", "or", "System", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test0", "1", "\\u", "Act", "or", "System", "Start", "up", "Shut", "down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ros", "alin", "e", "A_", "=_", "Act", "or", "System_", "(_", ")_", "._", "create", "Actor_", "(_", "ros", "alin", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "just", " ", "finish", ",", " ", "make", " ", "sure", " ", "no", " ", "exception", " ", "is", " ", "throw", "n", "._", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "AS", "impl", "e", "System_", "(_", "Act", "or", "System", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "1", "\\u", "1", "\\u", "Act", "or", "System", "Multipl", "e", "Shut", "down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ros", "alin", "e", "A_", "=_", "Act", "or", "System_", "(_", ")_", "._", "create", "Actor_", "(_", "ros", "alin", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Act", "or", "System_", "(_", ")_", "._", "shutdown_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Act", "or", "System_", "(_", ")_", "._", "shutdown_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "AS", "impl", "e", "System_", "(_", "Act", "or", "System", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "2", "\\u", "Prim", "ary", "Act", "or", "Creat", "ion_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rom", "eo_", "=_", "Act", "or", "System_", "(_", ")_", "._", "create", "Actor_", "(_", "Rom", "eo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "jul", "iet", "_", "=_", "Act", "or", "System_", "(_", ")_", "._", "create", "Actor_", "(_", "Juli", "et_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equal_", "(_", "rom", "eo_", ",_", "jul", "iet", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "AS", "impl", "e", "System_", "(_", "Act", "or", "System", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "3", "\\u", "Creat", "e", "Act", "or", "Unique", "Address_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rom", "eo_", "=_", "Act", "or", "System_", "(_", ")_", "._", "create", "Actor_", "(_", "Rom", "eo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "jul", "iet", "_", "=_", "Act", "or", "System_", "(_", ")_", "._", "create", "Actor_", "(_", "Juli", "et_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equal_", "(_", "rom", "eo_", ",_", "jul", "iet", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rom", "eo", "2_", "=_", "Act", "or", "System_", "(_", ")_", "._", "create", "Actor_", "(_", "Rom", "eo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equal_", "(_", "rom", "eo_", ",_", "rom", "eo", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "AS", "impl", "e", "System_", "(_", "Act", "or", "System", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "NO", "test0", "4", "\\u", "Poss", "ibl", "e", "Act", "or", "System", "Reso", "urc", "e", "Ex", "haus", "tion_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "asy", "s_", "=_", "Act", "or", "System_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "addresses_", "=_", "[_", "asy", "s_", "._", "create", "Actor_", "(_", "Juli", "et_", ")_", "for_", "n_", "in_", "range_", "(_", "10000_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "errno_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "err_", "._", "errno_", "==_", "errno_", "._", "EGA", "IN_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "AS", "impl", "e", "System_", "(_", "Act", "or", "System", "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_", "test0", "5", "\\u", "Many", "Act", "ors", "Unique", "Address_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "asy", "s_", "=_", "Act", "or", "System_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "addresses_", "=_", "[_", "asy", "s_", "._", "create", "Actor_", "(_", "Juli", "et_", ")_", "for_", "n_", "in_", "range_", "(_", "100_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unique", "Address", "es_", "=_", "set_", "(_", "addresses_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "addresses_", ")_", "!=_", "len_", "(_", "unique", "Address", "es_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "duplicates_", "=_", "[_", "A_", "for_", "A_", "in_", "unique", "Address", "es_", "if_", "len_", "(_", "[_", "X_", "for_", "X_", "in_", "addresses_", "if_", "X_", "==_", "A_", "]_", ")_", ">_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "Duplicate", "s", ":", " ", "%", "s", "'_", "%_", "map_", "(_", "str_", ",_", "duplicates_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "duplicates_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "each_", "in_", "duplicates_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "(_", "'...", " ", "%", "s", " ", "at", ":", " ", "%", "s", "'_", "%_", "(_", "str_", "(_", "each_", ")_", ",_", "str_", "(_", "[_", "N_", "for_", "N_", ",_", "A_", "in_", "enumerate_", "(_", "addresses_", ")_", "if_", "A_", "==_", "each_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "'", "Not", "e", ":", " ", "if", " ", "this", " ", "is", " ", "a", " ", "UD", "PT", "rans", "port", " ", "test", ",", " ", "be", " ", "advi", "sed", " ", "tha", "t", " ", "Lin", "ux", " ", "occ", "asi", "onal", "ly", " ", "doe", "s", " ", "see", "m", " ", "to", " ", "assign", " ", "the", " ", "same", " ", "UD", "P", " ", "port", " ", "multiple", " ", "times", ".", " ", " ", "Lin", "ux", " ", "bug", "?'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "addresses_", ")_", ",_", "len_", "(_", "unique", "Address", "es_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "AS", "impl", "e", "System_", "(_", "Act", "or", "System", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "6", "\\u", "Many", "Act", "ors", "Valid", "Address", "es_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "addresses_", "=_", "[_", "Act", "or", "System_", "(_", ")_", "._", "create", "Actor_", "(_", "Juli", "et_", ")_", "for_", "n_", "in_", "range_", "(_", "100_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "addr_", "in_", "addresses_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inv", "char_", "=_", "''_", "._", "join_", "(_", "[_", "c_", "for_", "c_", "in_", "str_", "(_", "addr_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "c_", "not_", "in_", "string_", "._", "ascii", "\\u", "letters_", "+_", "string_", "._", "digits_", "+_", "\"-", "~", "/(", "):", ".,", " ", "'|", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "str_", "(_", "addr_", ")_", ",_", "str_", "(_", "addr_", ")_", "+_", "inv", "char_", ")_", "#", " ", "inv", "char", " ", "shou", "ld", " ", "be", " ", "blank_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "AS", "impl", "e", "System_", "(_", "Act", "or", "System", "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_", "test0", "7", "\\u", "Sing", "le", "Non", "Listen", "ing", "Act", "or", "Tell", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ros", "alin", "e", "A_", "=_", "Act", "or", "System_", "(_", ")_", "._", "create", "Actor_", "(_", "ros", "alin", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "ros", "alin", "e", " ", "doe", "s", " ", "not", " ", "override", " ", "the", " ", "receive", "Messag", "e", " ", "method", ",", " ", "so", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Act", "or", " ", "default", " ", "method", " ", "will", " ", "throw", " ", "an", " ", "exception", ".", " ", " ", "Thi", "s", " ", "will", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Kill", " ", "the", " ", "ros", "alin", "e", " ", "Act", "or", ".", " ", " ", "It", "'", "s", " ", "a", " ", "top", " ", "level", " ", "Act", "or", ",", " ", "so", " ", "it", " ", "will", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "not", " ", "be", " ", "restart", "ed", ".", " ", " ", "Thi", "s", " ", "will", " ", "caus", "e", " ", "the", " ", "'", "hell", "o", "'", " ", "message", " ", "to", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "deliver", "ed", " ", "to", " ", "the", " ", "Dead", "Letter", "Box", ".", " ", " ", "Verify", " ", "tha", "t", " ", "no", " ", "exception_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", "s", " ", "its", " ", "way", " ", "out", " ", "of", " ", "the", " ", "Act", "or", "System", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "Act", "or", "System_", "(_", ")_", "._", "tell_", "(_", "ros", "alin", "e", "A_", ",_", "'", "hell", "o", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "AS", "impl", "e", "System_", "(_", "Act", "or", "System", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "8", "\\u", "Sing", "le", "Act", "or", "Tell", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rom", "eo", "A_", "=_", "Act", "or", "System_", "(_", ")_", "._", "create", "Actor_", "(_", "Rom", "eo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Act", "or", "System_", "(_", ")_", "._", "tell_", "(_", "rom", "eo", "A_", ",_", "'", "hell", "o", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Not", "hing", " ", "muc", "h", " ", "happ", "ens", ",", " ", "Rom", "eo", " ", "is", " ", "smit", "ten", " ", "and", " ", "has", " ", "no", " ", "time", " ", "for", " ", "trivial", "iti", "es", ",", " ", "but", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "he", " ", "will", " ", "try", " ", "to", " ", "generat", "e", " ", "str", "()", " ", "of", " ", "him", "self", "._", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "AS", "impl", "e", "System_", "(_", "Act", "or", "System", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "9", "\\u", "Sing", "le", "Act", "or", "As", "k_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rom", "eo", "A_", "=_", "Act", "or", "System_", "(_", ")_", "._", "create", "Actor_", "(_", "Rom", "eo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "Act", "or", "System_", "(_", ")_", "._", "ask_", "(_", "rom", "eo", "A_", ",_", "'", "O", " ", "Rom", "eo", ",", " ", "Rom", "eo", "!", " ", "where", "fore", " ", "art", " ", "tho", "u", " ", "Rom", "eo", "?'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", ",_", "'", "Sha", "ll", " ", "I", " ", "hear", " ", "more", ",", " ", "or", " ", "sha", "ll", " ", "I", " ", "speak", " ", "at", " ", "this", "?'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "AS", "impl", "e", "System_", "(_", "Act", "or", "System", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "10", "\\u", "Act", "or", "As", "k", "With", "No", "Response_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rom", "eo", "A_", "=_", "Act", "or", "System_", "(_", ")_", "._", "create", "Actor_", "(_", "Rom", "eo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "test", " ", "is", " ", "possib", "ly", " ", "unique", " ", "to", " ", "the", " ", "simple", "System", "Base", ",", " ", "which_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "will", " ", "run", " ", "an", " ", "process", " ", "all", " ", "message", "s", " ", "on", " ", "an", " ", "ask", " ", "(", "or", " ", "tell", ")", " ", "call", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Proper", "ly", " ", "there", " ", "is", " ", "no", " ", "way", " ", "to", " ", "dete", "rmin", "e", " ", "if", " ", "an", " ", "answer", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fort", "hco", "ming", " ", "from", " ", "an", " ", "async", "hronous", " ", "system", ",", " ", "so", " ", "all", " ", "this", " ", "can", " ", "do_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "assert", " ", "tha", "t", " ", "there", " ", "is", " ", "no", " ", "response", " ", "within", " ", "a", " ", "partic", "ular", " ", "time_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "period", ".", " ", " ", "At", " ", "this", " ", "point", ",", " ", "tim", "ing", " ", "is", " ", "not", " ", "support", "ed", ",", " ", "so", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "test", " ", "is", " ", "under", "specified", " ", "and", " ", "ass", "ump", "tiv", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "Act", "or", "System_", "(_", ")_", "._", "ask_", "(_", "rom", "eo", "A_", ",_", "\"", "What", "'", "s", " ", "in", " ", "a", " ", "name", "?", " ", "Tha", "t", " ", "whi", "ch", " ", "we", " ", "call", " ", "a", " ", "rose", "\"_", ",_", "1.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", "w", " ", "verify", " ", "tha", "t", " ", "the", " ", "Act", "or", " ", "and", " ", "system", " ", "are", " ", "still", " ", "alive", " ", "and", " ", "operati", "ng", " ", "normal", "ly", "._", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "Act", "or", "System_", "(_", ")_", "._", "ask_", "(_", "rom", "eo", "A_", ",_", "'", "O", " ", "Rom", "eo", ",", " ", "Rom", "eo", "!", " ", "where", "fore", " ", "art", " ", "tho", "u", " ", "Rom", "eo", "?'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", ",_", "'", "Sha", "ll", " ", "I", " ", "hear", " ", "more", ",", " ", "or", " ", "sha", "ll", " ", "I", " ", "speak", " ", "at", " ", "this", "?'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "AS", "impl", "e", "System_", "(_", "Act", "or", "System", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "11", "\\u", "Sing", "le", "Act", "or", "As", "k", "Multipl", "e", "Times_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rom", "eo", "A_", "=_", "Act", "or", "System_", "(_", ")_", "._", "create", "Actor_", "(_", "Rom", "eo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "Act", "or", "System_", "(_", ")_", "._", "ask_", "(_", "rom", "eo", "A_", ",_", "'", "O", " ", "Rom", "eo", ",", " ", "Rom", "eo", "!", " ", "where", "fore", " ", "art", " ", "tho", "u", " ", "Rom", "eo", "?'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Sha", "ll", " ", "I", " ", "hear", " ", "more", ",", " ", "or", " ", "sha", "ll", " ", "I", " ", "speak", " ", "at", " ", "this", "?'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "Act", "or", "System_", "(_", ")_", "._", "ask_", "(_", "rom", "eo", "A_", ",_", "'", "O", " ", "Rom", "eo", ",", " ", "Rom", "eo", "!", " ", "where", "fore", " ", "art", " ", "tho", "u", " ", "Rom", "eo", "?'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Sha", "ll", " ", "I", " ", "hear", " ", "more", ",", " ", "or", " ", "sha", "ll", " ", "I", " ", "speak", " ", "at", " ", "this", "?'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "Act", "or", "System_", "(_", ")_", "._", "ask_", "(_", "rom", "eo", "A_", ",_", "'", "Ay", " ", "me", "!'_", ")_", ",_", "'", "She", " ", "speak", "s", "!'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "Act", "or", "System_", "(_", ")_", "._", "ask_", "(_", "rom", "eo", "A_", ",_", "'", "O", " ", "Rom", "eo", ",", " ", "Rom", "eo", "!", " ", "where", "fore", " ", "art", " ", "tho", "u", " ", "Rom", "eo", "?'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Sha", "ll", " ", "I", " ", "hear", " ", "more", ",", " ", "or", " ", "sha", "ll", " ", "I", " ", "speak", " ", "at", " ", "this", "?'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "AS", "impl", "e", "System_", "(_", "Act", "or", "System", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "1", "2", "\\u", "Multipl", "e", "Act", "ors", "As", "k", "Multipl", "e", "Times_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "play_", "=_", "Act", "or", "System_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rom", "eo_", "=_", "play_", "._", "create", "Actor_", "(_", "Rom", "eo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "play_", "._", "ask_", "(_", "rom", "eo_", ",_", "'", "O", " ", "Rom", "eo", ",", " ", "Rom", "eo", "!", " ", "where", "fore", " ", "art", " ", "tho", "u", " ", "Rom", "eo", "?'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Sha", "ll", " ", "I", " ", "hear", " ", "more", ",", " ", "or", " ", "sha", "ll", " ", "I", " ", "speak", " ", "at", " ", "this", "?'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "jul", "iet", "_", "=_", "play_", "._", "create", "Actor_", "(_", "Juli", "et_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "play_", "._", "ask_", "(_", "rom", "eo_", ",_", "'", "O", " ", "Rom", "eo", ",", " ", "Rom", "eo", "!", " ", "where", "fore", " ", "art", " ", "tho", "u", " ", "Rom", "eo", "?'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Sha", "ll", " ", "I", " ", "hear", " ", "more", ",", " ", "or", " ", "sha", "ll", " ", "I", " ", "speak", " ", "at", " ", "this", "?'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "play_", "._", "ask_", "(_", "rom", "eo_", ",_", "'", "Ay", " ", "me", "!'_", ")_", ",_", "'", "She", " ", "speak", "s", "!'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "play_", "._", "ask_", "(_", "jul", "iet", "_", ",_", "'", "She", " ", "speak", "s", "!'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "O", " ", "Rom", "eo", ",", " ", "Rom", "eo", "!", " ", "where", "fore", " ", "art", " ", "tho", "u", " ", "Rom", "eo", "?'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "play_", "._", "ask_", "(_", "rom", "eo_", ",_", "'", "Ay", " ", "me", "!'_", ")_", ",_", "'", "She", " ", "speak", "s", "!'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "play_", "._", "ask_", "(_", "jul", "iet", "_", ",_", "\"", "Do", " ", "you", " ", "know", " ", "what", " ", "light", " ", "tha", "t", " ", "is", "?\"_", ")_", ",_", "'", "Ay", " ", "me", "!'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "AS", "impl", "e", "System_", "(_", "Act", "or", "System", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "13", "\\u", "Sub", "Act", "or", "Creat", "ion_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cap", "ule", "t_", "=_", "Act", "or", "System_", "(_", ")_", "._", "create", "Actor_", "(_", "Cap", "ule", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "jul", "iet", "_", "=_", "Act", "or", "System_", "(_", ")_", "._", "ask_", "(_", "cap", "ule", "t_", ",_", "'", "has", " ", "a", " ", "dau", "ghte", "r", "?'_", ",_", "2.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "Juli", "et", " ", "is", ":", " ", "%", "s", "'_", "%_", "str_", "(_", "jul", "iet", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not_", "(_", "jul", "iet", "_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "jul", "iet", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "Act", "or", "System_", "(_", ")_", "._", "ask_", "(_", "jul", "iet", "_", ",_", "'", "what", " ", "light", "?'_", ")_", ",_", "'", "Ay", " ", "me", "!'_", ",_", "0.75_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "jul", "iet", "2_", "=_", "Act", "or", "System_", "(_", ")_", "._", "ask_", "(_", "cap", "ule", "t_", ",_", "'", "has", " ", "a", " ", "dau", "ghte", "r", "?'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not_", "(_", "jul", "iet", "2_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "jul", "iet", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "Act", "or", "System_", "(_", ")_", "._", "ask_", "(_", "jul", "iet", "2_", ",_", "'", "what", " ", "light", "?'_", ")_", ",_", "'", "Ay", " ", "me", "!'_", ",_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "Act", "or", "System_", "(_", ")_", "._", "ask_", "(_", "jul", "iet", "_", ",_", "'", "what", " ", "light", "?'_", ")_", ",_", "'", "Ay", " ", "me", "!'_", ",_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "AS", "impl", "e", "System_", "(_", "Act", "or", "System", "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", "14", "\\u", "Ent", "ire", "Act", "With", "Act", "or", "Start_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "play_", "=_", "Act", "or", "System_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rom", "eo_", "=_", "play_", "._", "create", "Actor_", "(_", "Rom", "eo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "jul", "iet", "_", "=_", "play_", "._", "create", "Actor_", "(_", "Juli", "et_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nur", "se_", "=_", "play_", "._", "create", "Actor_", "(_", "Nu", "rse", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "play_", "._", "ask_", "(_", "nur", "se_", ",_", "'", "don", "e", "?'_", ")_", ",_", "'", "not", " ", "ye", "t", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "play_", "._", "tell_", "(_", "nur", "se_", ",_", "(_", "'", "begin", "'_", ",_", "rom", "eo_", ",_", "jul", "iet", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "X_", "in_", "range_", "(_", "50_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "play_", "._", "ask_", "(_", "nur", "se_", ",_", "'", "don", "e", "?'_", ")_", "==_", "'", "Fini", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.01_", ")_", "#", " ", "All", "ow", " ", "some", " ", "time", " ", "for", " ", "the", " ", "entire", " ", "act_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "play_", "._", "ask_", "(_", "nur", "se_", ",_", "'", "don", "e", "?'_", ")_", ",_", "'", "Fini", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "AS", "impl", "e", "System_", "(_", "Act", "or", "System", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "15", "\\u", "Incomp", "lete", "Act", "Missing", "Actor_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "play_", "=_", "Act", "or", "System_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rom", "eo_", "=_", "play_", "._", "create", "Actor_", "(_", "Rom", "eo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "jul", "iet", "_", "=_", "play_", "._", "create", "Actor_", "(_", "Juli", "et_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "no", " ", "nur", "se", " ", "actor", " ", "created_", "\\u\\u\\uNL\\u\\u\\u_", "play_", "._", "tell_", "(_", "rom", "eo_", ",_", "Juli", "et", "App", "ear", "s_", "(_", "jul", "iet", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", " ", "error", " ", "shou", "ld", " ", "occur", " ", "here", " ", "whe", "n", " ", "Juli", "et", " ", "reache", "s", " ", "the", " ", "end", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "doe", "sn", "'", "t", " ", "have", " ", "a", " ", "nur", "se", " ", "to", " ", "tell", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.5_", ")_", "#", " ", "All", "ow", " ", "some", " ", "time", " ", "for", " ", "the", " ", "entire", " ", "act_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "create", " ", "the", " ", "nur", "se", " ", "and", " ", "tell", " ", "her", " ", "to", " ", "talk", " ", "to", " ", "rom", "eo", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "jul", "iet", ",", " ", "whi", "ch", " ", "shou", "ld", " ", "caus", "e", " ", "completion_", "\\u\\u\\uNL\\u\\u\\u_", "nur", "se_", "=_", "play_", "._", "create", "Actor_", "(_", "Nu", "rse", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "play_", "._", "ask_", "(_", "nur", "se_", ",_", "'", "don", "e", "?'_", ")_", ",_", "'", "not", " ", "ye", "t", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "play_", "._", "tell_", "(_", "nur", "se_", ",_", "(_", "'", "begin", "'_", ",_", "rom", "eo_", ",_", "jul", "iet", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "X_", "in_", "range_", "(_", "50_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "play_", "._", "ask_", "(_", "nur", "se_", ",_", "'", "don", "e", "?'_", ")_", "==_", "'", "Fini", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.01_", ")_", "#", " ", "All", "ow", " ", "some", " ", "time", " ", "for", " ", "the", " ", "entire", " ", "act_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "play_", "._", "ask_", "(_", "nur", "se_", ",_", "'", "don", "e", "?'_", ")_", ",_", "'", "Fini", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "AS", "impl", "e", "System_", "(_", "Act", "or", "System", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "16", "\\u", "Act", "or", "Properties_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "play_", "=_", "Act", "or", "System_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rom", "eo_", "=_", "play_", "._", "create", "Actor_", "(_", "Rom", "eo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "jul", "iet", "_", "=_", "play_", "._", "create", "Actor_", "(_", "Juli", "et_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "play_", "._", "ask_", "(_", "rom", "eo_", ",_", "'", "who", "\\u", "are", "\\u", "you", "'_", ",_", "0.25_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "play_", "._", "ask_", "(_", "jul", "iet", "_", ",_", "'", "who", "\\u", "are", "\\u", "you", "'_", ",_", "0.25_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equal_", "(_", "play_", "._", "ask_", "(_", "rom", "eo_", ",_", "'", "who", "\\u", "are", "\\u", "you", "'_", ",_", "0.25_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "play_", "._", "ask_", "(_", "jul", "iet", "_", ",_", "'", "who", "\\u", "are", "\\u", "you", "'_", ",_", "0.25_", ")_", ")_", "\\u\\u\\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", "Multi", "proc", "UD", "PS", "ystem_", "(_", "Test", "AS", "impl", "e", "System_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "testb", "ase_", "=_", "'", "Multi", "proc", "UD", "P", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Multi", "proc", "UD", "PS", "ystem_", "(_", "Test", "AS", "impl", "e", "System_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set", "System", "Base_", "(_", "'", "multipro", "c", "UD", "PB", "ase", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Test", "Multi", "proc", "UD", "PS", "ystem_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\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", "Multi", "proc", "TC", "PS", "ystem_", "(_", "Test", "AS", "impl", "e", "System_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "testb", "ase_", "=_", "'", "Multi", "proc", "TC", "P", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Multi", "proc", "TC", "PS", "ystem_", "(_", "Test", "AS", "impl", "e", "System_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set", "System", "Base_", "(_", "'", "multipro", "c", "TC", "PB", "ase", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Test", "Multi", "proc", "TC", "PS", "ystem_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\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", "Multi", "proc", "Queue", "System_", "(_", "Test", "AS", "impl", "e", "System_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "testb", "ase_", "=_", "'", "Multi", "proc", "Queue", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Multi", "proc", "Queue", "System_", "(_", "Test", "AS", "impl", "e", "System_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set", "System", "Base_", "(_", "'", "multipro", "c", "Queue", "Base", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Test", "Multi", "proc", "Queue", "System_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
h0ke/pynt/pynt/pynt.py
[ { "content": "\"\"\"\n Pynt is a Python client that wraps the Open Beer Database API.\n\n Questions, comments? [email protected]\n\"\"\"\n\n__author__ = \"Matthew Hokanson <[email protected]>\"\n__version__ = \"0.2.0\"\n\n\nfrom beer import Beer\nfrom brewery import Brewery\nfrom request import Request\nfrom settings import Settings\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from beer import Beer", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 21 }, { "span": "from brewery import Brewery", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 27 }, { "span": "from request import Request", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 27 }, { "span": "from settings import Settings", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 29 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Py", "nt", " ", "is", " ", "a", " ", "Pyth", "on", " ", "client", " ", "tha", "t", " ", "wrap", "s", " ", "the", " ", "Open", " ", "Bee", "r", " ", "Databa", "se", " ", "API", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Questions", ",", " ", "comment", "s", "?", " ", "m", "@", "h", "0", "ke", ".", "com", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "author\\u\\u_", "=_", "\"", "Matt", "hew", " ", "Ho", "kan", "son", " ", "<", "m", "@", "h", "0", "ke", ".", "com", ">\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "version\\u\\u_", "=_", "\"", "0.", "2.0", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "beer", "_", "import_", "Bee", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "brew", "ery", "_", "import_", "Bre", "wer", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "request_", "import_", "Request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "settings_", "import_", "Settings_" ]
[ 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, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1 ]
Unused import
dimagi/commcare-hq/corehq/apps/app_manager/fields.py
[ { "content": "import logging\nfrom django.conf import settings\nfrom django.core.urlresolvers import reverse\nfrom django.http import Http404\nimport collections\nimport itertools\nfrom django import forms\nfrom django.utils.translation import ugettext as _\nfrom corehq.apps.app_manager.analytics import get_exports_by_application\nfrom corehq.apps.app_manager.dbaccessors import get_apps_in_domain, get_app\nfrom corehq.apps.app_manager.models import Application\nfrom corehq.form_processor.interfaces.dbaccessors import CaseAccessors\nfrom couchforms.analytics import get_exports_by_form\nfrom couchforms.models import XFormInstance\nfrom dimagi.utils.decorators.memoized import memoized\n\n\nApplicationDataSource = collections.namedtuple('ApplicationDataSource', ['application', 'source_type', 'source'])\nRMIDataChoice = collections.namedtuple('RMIDataChoice', ['id', 'text', 'data'])\nAppFormRMIResponse = collections.namedtuple('AppFormRMIResponse', [\n 'app_types', 'apps_by_type', 'modules_by_app',\n 'forms_by_app_by_module', 'placeholders'\n])\nAppFormRMIPlaceholder = collections.namedtuple('AppFormRMIPlaceholder', [\n 'application', 'module', 'form'\n])\nAppCaseRMIResponse = collections.namedtuple('AppCaseRMIResponse', [\n 'app_types', 'apps_by_type', 'case_types_by_app', 'placeholders'\n])\nAppCaseRMIPlaceholder = collections.namedtuple('AppCaseRMIPlaceholder', [\n 'application', 'case_type'\n])\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ApplicationDataSourceUIHelper(object):\n \"\"\"\n A helper object that can be used in forms that allows you to select a data source from an application.\n Data sources can be forms and cases.\n\n To use it you must do the following:\n\n - Add this helper as a member variable of your form\n - Call helper.boostrap() with the domain.\n - Add helper.get_fields() to the form fields.\n - Add the following knockout bindings to your template:\n\n $(function () {\n $(\"#FORM\").koApplyBindings({\n application: ko.observable(\"\"),\n sourceType: ko.observable(\"\"),\n sourcesMap: {{ sources_map|JSON }}\n });\n });\n\n Where FORM is a selector for your form and sources_map is the .all_sources property from this object\n (which gets set after bootstrap).\n\n See usages for examples.\n \"\"\"\n\n\n\n", "metadata": "root.ApplicationDataSourceUIHelper", "header": "['module', '___EOS___']", "index": 34 }, { "content": " def __init__(self, enable_cases=True, enable_forms=True):\n self.all_sources = {}\n self.enable_cases = enable_cases\n self.enable_forms = enable_forms\n source_choices = []\n if enable_cases:\n source_choices.append((\"case\", _(\"Case\")))\n if enable_forms:\n source_choices.append((\"form\", _(\"Form\")))\n\n self.application_field = forms.ChoiceField(label=_('Application'), widget=forms.Select())\n if enable_cases and enable_forms:\n self.source_type_field = forms.ChoiceField(label=_('Type of Data'),\n choices=source_choices,\n widget=forms.Select(choices=source_choices))\n else:\n self.source_type_field = forms.ChoiceField(choices=source_choices,\n widget=forms.HiddenInput(),\n initial=source_choices[0][0])\n\n self.source_field = forms.ChoiceField(label=_('Data Source'), widget=forms.Select())", "metadata": "root.ApplicationDataSourceUIHelper.__init__", "header": "['class', 'ApplicationDataSourceUIHelper', '(', 'object', ')', ':', '___EOS___']", "index": 60 }, { "content": " def bootstrap(self, domain):\n self.all_sources = get_app_sources(domain)\n self.application_field.choices = sorted(\n [(app_id, source['name']) for app_id, source in self.all_sources.items()],\n key=lambda id_name_tuple: (id_name_tuple[1] or '').lower()\n )\n self.source_field.choices = []\n\n def _add_choices(field, choices):\n field.choices.extend(choices)\n # it's weird/annoying that you have to manually sync these\n field.widget.choices.extend(choices)\n\n if self.enable_cases:\n _add_choices(\n self.source_field,\n [(ct['value'], ct['text']) for app in self.all_sources.values() for ct in app['case']]\n )\n if self.enable_forms:\n _add_choices(\n self.source_field,\n [(ct['value'], ct['text']) for app in self.all_sources.values() for ct in app['form']]\n )\n\n # NOTE: This corresponds to a view-model that must be initialized in your template.\n # See the doc string of this class for more information.\n self.application_field.widget.attrs = {'data-bind': 'value: application'}\n self.source_type_field.widget.attrs = {'data-bind': 'value: sourceType'}\n self.source_field.widget.attrs = {'data-bind': '''\n options: sourcesMap[application()][sourceType()],\n optionsText: function(item){return item.text},\n optionsValue: function(item){return item.value}\n '''}", "metadata": "root.ApplicationDataSourceUIHelper.bootstrap", "header": "['class', 'ApplicationDataSourceUIHelper', '(', 'object', ')', ':', '___EOS___']", "index": 82 }, { "content": " def get_fields(self):\n fields = collections.OrderedDict()\n fields['source_type'] = self.source_type_field\n fields['application'] = self.application_field\n fields['source'] = self.source_field\n return fields", "metadata": "root.ApplicationDataSourceUIHelper.get_fields", "header": "['class', 'ApplicationDataSourceUIHelper', '(', 'object', ')', ':', '___EOS___']", "index": 116 }, { "content": " def get_app_source(self, data_dict):\n return ApplicationDataSource(data_dict['application'], data_dict['source_type'], data_dict['source'])", "metadata": "root.ApplicationDataSourceUIHelper.get_app_source", "header": "['class', 'ApplicationDataSourceUIHelper', '(', 'object', ')', ':', '___EOS___']", "index": 123 }, { "content": "def get_app_sources(domain):\n apps = get_apps_in_domain(domain, include_remote=False)\n return {\n app._id: {\n \"name\": app.name,\n \"case\": [{\"text\": t, \"value\": t} for t in app.get_case_types()],\n \"form\": [\n {\n \"text\": u'{} / {}'.format(form.get_module().default_name(), form.default_name()),\n \"value\": form.get_unique_id()\n } for form in app.get_forms()\n ]\n }\n for app in apps\n }", "metadata": "root.get_app_sources", "header": "['module', '___EOS___']", "index": 127 }, { "content": "class ApplicationDataRMIHelper(object):\n \"\"\"ApplicationDataRMIHelper is meant to generate the response for the\n djangoRMI methods required to initialize form controlled by\n hq.app_data_drilldown.ng.js.\n\n Note / todo: This Helper should be merged with ApplicationDataSourceUIHelper.\n Holding off to a different PR, as I want to isolate QA to just the exports\n (the first thing to use this) --Biyeun\n\n \"\"\"\n UNKNOWN_SOURCE = '_unknown'\n\n APP_TYPE_ALL = 'all'\n APP_TYPE_DELETED = 'deleted'\n APP_TYPE_REMOTE = 'remote'\n APP_TYPE_NONE = 'no_app'\n APP_TYPE_UNKNOWN = 'unknown'\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.ApplicationDataRMIHelper", "header": "['module', '___EOS___']", "index": 144 }, { "content": " def __init__(self, domain, as_dict=True, form_placeholders=None, case_placeholders=None):\n self.domain = domain\n self.as_dict = as_dict\n default_form_placeholder = AppFormRMIPlaceholder(\n application=_(\"Select Application\"),\n module=_(\"Select Module\"),\n form=_(\"Select Form\"),\n )\n self.form_placeholders = form_placeholders or default_form_placeholder\n default_case_placeholder = AppCaseRMIPlaceholder(\n application=_(\"Select Application\"),\n case_type=_(\"Select Case Type\"),\n )\n self.case_placeholders = case_placeholders or default_case_placeholder\n if self.as_dict:\n self.form_placeholders = self.form_placeholders._asdict()\n self.case_placeholders = self.case_placeholders._asdict()", "metadata": "root.ApplicationDataRMIHelper.__init__", "header": "['class', 'ApplicationDataRMIHelper', '(', 'object', ')', ':', '___EOS___']", "index": 162 }, { "content": " def _get_unknown_form_possibilities(self):\n possibilities = collections.defaultdict(list)\n for app in get_exports_by_application(self.domain):\n # index by xmlns\n x = app['value']\n x['has_app'] = True\n possibilities[app['key'][2]].append(x)\n return possibilities", "metadata": "root.ApplicationDataRMIHelper._get_unknown_form_possibilities", "header": "['class', 'ApplicationDataRMIHelper', '(', 'object', ')', ':', '___EOS___']", "index": 180 }, { "content": " def _attach_unknown_suggestions(self, unknown_forms):\n \"\"\"If there are any unknown forms, try and find the best possible matches\n from deleted apps or copied apps. If no suggestion is found, say so\n but provide the xmlns.\n \"\"\"\n if unknown_forms:\n possibilities = self._get_unknown_form_possibilities()\n\n class AppCache(dict):\n def __init__(self, domain):\n super(AppCache, self).__init__()\n self.domain = domain\n\n def __getitem__(self, item):\n if item not in self:\n try:\n self[item] = get_app(app_id=item, domain=self.domain)\n except Http404:\n pass\n return super(AppCache, self).__getitem__(item)\n\n app_cache = AppCache(self.domain)\n\n for form in unknown_forms:\n app = None\n if form['app']['id']:\n try:\n app = app_cache[form['app']['id']]\n form['has_app'] = True\n except KeyError:\n form['app_does_not_exist'] = True\n form['possibilities'] = possibilities[form['xmlns']]\n if form['possibilities']:\n form['duplicate'] = True\n else:\n if app.domain != self.domain:\n logging.error(\"submission tagged with app from wrong domain: %s\" % app.get_id)\n else:\n if app.copy_of:\n try:\n app = app_cache[app.copy_of]\n form['app_copy'] = {'id': app.get_id, 'name': app.name}\n except KeyError:\n form['app_copy'] = {'id': app.copy_of, 'name': '?'}\n if app.is_deleted():\n form['app_deleted'] = {'id': app.get_id}\n try:\n app_forms = app.get_xmlns_map()[form['xmlns']]\n except AttributeError:\n # it's a remote app\n app_forms = None\n form['has_app'] = True\n if app_forms:\n app_form = app_forms[0]\n if app_form.doc_type == 'UserRegistrationForm':\n form['is_user_registration'] = True\n else:\n app_module = app_form.get_module()\n form['module'] = app_module\n form['form'] = app_form\n form['show_xmlns'] = False\n\n if not form.get('app_copy') and not form.get('app_deleted'):\n form['no_suggestions'] = True\n if app:\n form['app'] = {'id': app.get_id, 'name': app.name, 'langs': app.langs}\n else:\n form['possibilities'] = possibilities[form['xmlns']]\n if form['possibilities']:\n form['duplicate'] = True\n else:\n form['no_suggestions'] = True\n return unknown_forms", "metadata": "root.ApplicationDataRMIHelper._attach_unknown_suggestions", "header": "['class', 'ApplicationDataRMIHelper', '(', 'object', ')', ':', '___EOS___']", "index": 189 }, { "content": " @staticmethod\n def _sorkey_form(form):\n app_id = form['app']['id']\n if form.get('has_app', False):\n order = 0 if not form.get('app_deleted') else 1\n app_name = form['app']['name']\n module = form.get('module')\n if module:\n # module is sometimes wrapped json, sometimes a dict!\n module_id = module['id'] if 'id' in module else module.id\n else:\n module_id = -1 if form.get('is_user_registration') else 1000\n app_form = form.get('form')\n if app_form:\n # app_form is sometimes wrapped json, sometimes a dict!\n form_id = app_form['id'] if 'id' in app_form else app_form.id\n else:\n form_id = -1\n return (order, app_name, app_id, module_id, form_id)\n else:\n form_xmlns = form['xmlns']\n return (2, form_xmlns, app_id)", "metadata": "root.ApplicationDataRMIHelper._sorkey_form", "header": "['class', 'ApplicationDataRMIHelper', '(', 'object', ')', ':', '___EOS___']", "index": 263 }, { "content": " @property\n @memoized\n def _all_forms(self):\n forms = []\n unknown_forms = []\n for f in get_exports_by_form(self.domain):\n form = f['value']\n if form.get('app_deleted') and not form.get('submissions'):\n continue\n if 'app' in form:\n form['has_app'] = True\n forms.append(form)\n else:\n app_id = f['key'][1] or ''\n form['app'] = {\n 'id': app_id\n }\n form['has_app'] = False\n form['show_xmlns'] = True\n unknown_forms.append(form)\n forms.extend(self._attach_unknown_suggestions(unknown_forms))\n return sorted(forms, key=self._sorkey_form)", "metadata": "root.ApplicationDataRMIHelper._all_forms", "header": "['class', 'ApplicationDataRMIHelper', '(', 'object', ')', ':', '___EOS___']", "index": 286 }, { "content": " @property\n @memoized\n def _no_app_forms(self):\n return filter(lambda f: not f.get('has_app', False), self._all_forms)", "metadata": "root.ApplicationDataRMIHelper._no_app_forms", "header": "['class', 'ApplicationDataRMIHelper', '(', 'object', ')', ':', '___EOS___']", "index": 309 }, { "content": " @property\n @memoized\n def _remote_app_forms(self):\n return filter(lambda f: f.get('has_app', False) and f.get('show_xmlns', False), self._all_forms)", "metadata": "root.ApplicationDataRMIHelper._remote_app_forms", "header": "['class', 'ApplicationDataRMIHelper', '(', 'object', ')', ':', '___EOS___']", "index": 314 }, { "content": " @property\n @memoized\n def _deleted_app_forms(self):\n return filter(\n lambda f: f.get('has_app', False) and f.get('app_deleted') and not f.get('show_xmlns', False),\n self._all_forms\n )", "metadata": "root.ApplicationDataRMIHelper._deleted_app_forms", "header": "['class', 'ApplicationDataRMIHelper', '(', 'object', ')', ':', '___EOS___']", "index": 319 }, { "content": " @property\n @memoized\n def _available_app_forms(self):\n return filter(\n lambda f: f.get('has_app', False) and not f.get('app_deleted') and not f.get('show_xmlns', False),\n self._all_forms\n )", "metadata": "root.ApplicationDataRMIHelper._available_app_forms", "header": "['class', 'ApplicationDataRMIHelper', '(', 'object', ')', ':', '___EOS___']", "index": 327 }, { "content": " @property\n @memoized\n def _unknown_forms(self):\n return itertools.chain(self._deleted_app_forms, self._remote_app_forms, self._no_app_forms)", "metadata": "root.ApplicationDataRMIHelper._unknown_forms", "header": "['class', 'ApplicationDataRMIHelper', '(', 'object', ')', ':', '___EOS___']", "index": 335 }, { "content": " def _get_app_type_choices(self, as_dict=True):\n choices = [(_(\"Applications\"), self.APP_TYPE_ALL)]\n if self._remote_app_forms or self._deleted_app_forms:\n choices.append((_(\"Unknown\"), self.APP_TYPE_UNKNOWN))\n choices = map(lambda c: RMIDataChoice(id=c[1], text=c[0], data={}), choices)\n if as_dict:\n choices = map(lambda c: c._asdict(), choices)\n return choices", "metadata": "root.ApplicationDataRMIHelper._get_app_type_choices", "header": "['class', 'ApplicationDataRMIHelper', '(', 'object', ')', ':', '___EOS___']", "index": 340 }, { "content": " @staticmethod\n def _get_unique_choices(choices):\n final_choices = collections.defaultdict(list)\n for k, val_list in choices.items():\n new_val_ids = []\n final_choices[k] = []\n for v in val_list:\n if v.id not in new_val_ids:\n new_val_ids.append(v.id)\n final_choices[k].append(v)\n return final_choices", "metadata": "root.ApplicationDataRMIHelper._get_unique_choices", "header": "['class', 'ApplicationDataRMIHelper', '(', 'object', ')', ':', '___EOS___']", "index": 349 }, { "content": " def _get_applications_by_type(self, as_dict=True):\n apps_by_type = (\n (self.APP_TYPE_ALL, self._available_app_forms),\n (self.APP_TYPE_UNKNOWN, self._unknown_forms)\n )\n _app_fmt = lambda c: (c[0], map(lambda f: RMIDataChoice(\n f['app']['id'] if f.get('has_app', False) else self.UNKNOWN_SOURCE,\n f['app']['name'] if f.get('has_app', False) else _(\"Unknown Application\"),\n f\n ), c[1]))\n apps_by_type = map(_app_fmt, apps_by_type)\n apps_by_type = dict(apps_by_type)\n apps_by_type = self._get_unique_choices(apps_by_type)\n\n # include restore URL for deleted apps\n for app in apps_by_type[self.APP_TYPE_DELETED]:\n app.data['restoreUrl'] = reverse('view_app', args=[self.domain, app.id])\n\n if as_dict:\n apps_by_type = self._map_chosen_by_choice_as_dict(apps_by_type)\n return apps_by_type", "metadata": "root.ApplicationDataRMIHelper._get_applications_by_type", "header": "['class', 'ApplicationDataRMIHelper', '(', 'object', ')', ':', '___EOS___']", "index": 361 }, { "content": " @staticmethod\n def _map_chosen_by_choice_as_dict(chosen_by_choice):\n for k, v in chosen_by_choice.items():\n chosen_by_choice[k] = map(lambda f: f._asdict(), v)\n return chosen_by_choice", "metadata": "root.ApplicationDataRMIHelper._map_chosen_by_choice_as_dict", "header": "['class', 'ApplicationDataRMIHelper', '(', 'object', ')', ':', '___EOS___']", "index": 383 }, { "content": " @staticmethod\n def _get_item_name(item, has_app, app_lang, default_name):\n item_name = None\n if has_app and item is not None:\n item_name = item['name'].get(app_lang) or item['name'].get('en')\n return item_name or default_name", "metadata": "root.ApplicationDataRMIHelper._get_item_name", "header": "['class', 'ApplicationDataRMIHelper', '(', 'object', ')', ':', '___EOS___']", "index": 389 }, { "content": " def _get_modules_and_forms(self, as_dict=True):\n modules_by_app = collections.defaultdict(list)\n forms_by_app_by_module = {}\n for form in self._all_forms:\n has_app = form.get('has_app', False)\n app_lang = form['app']['langs'][0] if 'langs' in form['app'] else 'en'\n app_id = form['app']['id'] if has_app else self.UNKNOWN_SOURCE\n module = form.get('module')\n module_id = (module['id'] if has_app and module is not None\n else self.UNKNOWN_SOURCE)\n module_name = self._get_item_name(\n module, has_app, app_lang, _(\"Unknown Module\")\n )\n form_xmlns = form['xmlns']\n form_name = form_xmlns\n if not form.get('show_xmlns', False):\n form_name = self._get_item_name(\n form.get('form'), has_app, app_lang,\n \"{} (potential matches)\".format(form_xmlns)\n )\n module_choice = RMIDataChoice(\n module_id,\n module_name,\n form\n )\n form_choice = RMIDataChoice(\n form_xmlns,\n form_name,\n form\n )\n if as_dict:\n form_choice = form_choice._asdict()\n\n if app_id not in forms_by_app_by_module:\n forms_by_app_by_module[app_id] = collections.defaultdict(list)\n modules_by_app[app_id].append(module_choice)\n forms_by_app_by_module[app_id][module_id].append(form_choice)\n\n modules_by_app = self._get_unique_choices(modules_by_app)\n if as_dict:\n modules_by_app = self._map_chosen_by_choice_as_dict(modules_by_app)\n return modules_by_app, forms_by_app_by_module", "metadata": "root.ApplicationDataRMIHelper._get_modules_and_forms", "header": "['class', 'ApplicationDataRMIHelper', '(', 'object', ')', ':', '___EOS___']", "index": 396 }, { "content": " def get_form_rmi_response(self):\n \"\"\"Use this to generate the response that initializes the form\n controlled by hq.app_data_drilldown.ng.js if you are drilling down\n to an XForm + app_id pair\"\"\"\n modules_by_app, forms_by_app_by_module = self._get_modules_and_forms(self.as_dict)\n response = AppFormRMIResponse(\n app_types=self._get_app_type_choices(self.as_dict),\n apps_by_type=self._get_applications_by_type(self.as_dict),\n modules_by_app=modules_by_app,\n forms_by_app_by_module=forms_by_app_by_module,\n placeholders=self.form_placeholders,\n )\n if self.as_dict:\n response = response._asdict()\n return response", "metadata": "root.ApplicationDataRMIHelper.get_form_rmi_response", "header": "['class', 'ApplicationDataRMIHelper', '(', 'object', ')', ':', '___EOS___']", "index": 439 }, { "content": " def _get_cases_for_apps(self, apps_by_type, as_dict=True):\n used_case_types = set()\n case_types_by_app = collections.defaultdict(list)\n for app_type, apps in apps_by_type.items():\n for app_choice in apps:\n if not app_choice.id == self.UNKNOWN_SOURCE:\n app = get_app(self.domain, app_choice.id)\n case_types = []\n if hasattr(app, 'modules'):\n case_types = set([\n module.case_type\n for module in app.modules if module.case_type\n ])\n used_case_types = used_case_types.union(case_types)\n case_types = map(lambda c: RMIDataChoice(\n id=c,\n text=c,\n data=app_choice.data\n ), case_types)\n if as_dict:\n case_types = map(lambda c: c._asdict(), case_types)\n case_types_by_app[app_choice.id] = case_types\n else:\n all_case_types = CaseAccessors(self.domain).get_case_types()\n unknown_case_types = all_case_types.difference(used_case_types)\n unknown_case_types = map(lambda c: RMIDataChoice(\n id=c,\n text=c,\n data={\n 'unknown': True,\n }\n ), unknown_case_types)\n if as_dict:\n unknown_case_types = map(lambda c: c._asdict(), unknown_case_types)\n case_types_by_app[self.UNKNOWN_SOURCE] = unknown_case_types\n\n return case_types_by_app", "metadata": "root.ApplicationDataRMIHelper._get_cases_for_apps", "header": "['class', 'ApplicationDataRMIHelper', '(', 'object', ')', ':', '___EOS___']", "index": 455 }, { "content": " def get_case_rmi_response(self):\n \"\"\"Use this to generate a response that initializes the form\n controlled by hq.app_data_drilldown.ng.js if you are drilling down to\n a Case Type.\n \"\"\"\n apps_by_type = self._get_applications_by_type(as_dict=False)\n case_types_by_app = self._get_cases_for_apps(apps_by_type, self.as_dict)\n if self.as_dict:\n apps_by_type = self._map_chosen_by_choice_as_dict(apps_by_type)\n response = AppCaseRMIResponse(\n app_types=self._get_app_type_choices(),\n apps_by_type=apps_by_type,\n case_types_by_app=case_types_by_app,\n placeholders=self.case_placeholders\n )\n if self.as_dict:\n response = response._asdict()\n return response", "metadata": "root.ApplicationDataRMIHelper.get_case_rmi_response", "header": "['class', 'ApplicationDataRMIHelper', '(', 'object', ')', ':', '___EOS___']", "index": 493 } ]
[ { "span": "from django.conf import settings", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 32 }, { "span": "from corehq.apps.app_manager.models import Application", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 54 }, { "span": "from couchforms.models import XFormInstance", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 43 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "urlresolvers_", "import_", "reverse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "http_", "import_", "Http404_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "collections_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "itertools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "import_", "forms_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "translation_", "import_", "ugettext_", "as_", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "app", "\\u", "manager_", "._", "analytics", "_", "import_", "get", "\\u", "export", "s", "\\u", "by", "\\u", "application_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "app", "\\u", "manager_", "._", "dba", "ccess", "ors_", "import_", "get", "\\u", "apps", "\\u", "in", "\\u", "domain_", ",_", "get", "\\u", "app_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "app", "\\u", "manager_", "._", "models_", "import_", "Application_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "form", "\\u", "processor_", "._", "interfaces_", "._", "dba", "ccess", "ors_", "import_", "Case", "Accessor", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "couch", "forms_", "._", "analytics", "_", "import_", "get", "\\u", "export", "s", "\\u", "by", "\\u", "form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "couch", "forms_", "._", "models_", "import_", "XF", "orm", "Instance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "dim", "agi", "_", "._", "utils_", "._", "decorators_", "._", "memoized", "_", "import_", "memoized", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Applica", "tion", "Data", "Source_", "=_", "collections_", "._", "namedtuple_", "(_", "'", "Applica", "tion", "Data", "Sou", "rce", "'_", ",_", "[_", "'", "applica", "tion", "'_", ",_", "'", "source", "\\u", "type", "'_", ",_", "'", "source", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "RM", "ID", "ata", "Choice_", "=_", "collections_", "._", "namedtuple_", "(_", "'", "RM", "ID", "ata", "Choi", "ce", "'_", ",_", "[_", "'", "id", "'_", ",_", "'", "text", "'_", ",_", "'", "data", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "App", "Form", "RM", "IR", "esp", "ons", "e_", "=_", "collections_", "._", "namedtuple_", "(_", "'", "App", "Form", "RM", "IR", "esp", "ons", "e", "'_", ",_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "app", "\\u", "types", "'_", ",_", "'", "apps", "\\u", "by", "\\u", "type", "'_", ",_", "'", "module", "s", "\\u", "by", "\\u", "app", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "forms", "\\u", "by", "\\u", "app", "\\u", "by", "\\u", "module", "'_", ",_", "'", "placehold", "ers", "'_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "App", "Form", "RM", "IP", "lace", "holder_", "=_", "collections_", "._", "namedtuple_", "(_", "'", "App", "Form", "RM", "IP", "lace", "holder", "'_", ",_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "applica", "tion", "'_", ",_", "'", "module", "'_", ",_", "'", "form", "'_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "App", "Case", "RM", "IR", "esp", "ons", "e_", "=_", "collections_", "._", "namedtuple_", "(_", "'", "App", "Case", "RM", "IR", "esp", "ons", "e", "'_", ",_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "app", "\\u", "types", "'_", ",_", "'", "apps", "\\u", "by", "\\u", "type", "'_", ",_", "'", "case", "\\u", "types", "\\u", "by", "\\u", "app", "'_", ",_", "'", "placehold", "ers", "'_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "App", "Case", "RM", "IP", "lace", "holder_", "=_", "collections_", "._", "namedtuple_", "(_", "'", "App", "Case", "RM", "IP", "lace", "holder", "'_", ",_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "applica", "tion", "'_", ",_", "'", "case", "\\u", "type", "'_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Applica", "tion", "Data", "Sou", "rce", "UI", "Helper_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "help", "er", " ", "object", " ", "tha", "t", " ", "can", " ", "be", " ", "used", " ", "in", " ", "forms", " ", "tha", "t", " ", "allow", "s", " ", "you", " ", "to", " ", "select", " ", "a", " ", "data", " ", "source", " ", "from", " ", "an", " ", "applica", "tion", ".", "\\", "10", ";", " ", " ", " ", " ", "Data", " ", "source", "s", " ", "can", " ", "be", " ", "forms", " ", "and", " ", "case", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "To", " ", "use", " ", "it", " ", "you", " ", "must", " ", "do", " ", "the", " ", "follow", "ing", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "Add", " ", "this", " ", "help", "er", " ", "as", " ", "a", " ", "member", " ", "variab", "le", " ", "of", " ", "your", " ", "form", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "Call", " ", "help", "er", ".", "boost", "rap", "()", " ", "with", " ", "the", " ", "domain", ".", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "Add", " ", "help", "er", ".", "get", "\\u", "fields", "()", " ", "to", " ", "the", " ", "form", " ", "fields", ".", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "Add", " ", "the", " ", "follow", "ing", " ", "kno", "cko", "ut", " ", "bindi", "ngs", " ", "to", " ", "your", " ", "template", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "$(", "function", " ", "()", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "$(", "\"#", "FORM", "\")", ".", "ko", "Apply", "Bindings", "({", "\\", "10", ";", " ", " ", " ", " ", "applica", "tion", ":", " ", "ko", ".", "observable", "(\"", "\")", ",", "\\", "10", ";", " ", " ", " ", " ", "source", "Type", ":", " ", "ko", ".", "observable", "(\"", "\")", ",", "\\", "10", ";", " ", " ", " ", " ", "source", "s", "Map", ":", " ", "{{", " ", "source", "s", "\\u", "map", "|", "JSO", "N", " ", "}}\\", "10", ";", " ", " ", " ", " ", "})", ";", "\\", "10", ";", " ", " ", " ", " ", "})", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Whe", "re", " ", "FORM", " ", "is", " ", "a", " ", "select", "or", " ", "for", " ", "your", " ", "form", " ", "and", " ", "source", "s", "\\u", "map", " ", "is", " ", "the", " ", ".", "all", "\\u", "source", "s", " ", "property", " ", "from", " ", "this", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "(", "whi", "ch", " ", "gets", " ", "set", " ", "after", " ", "boots", "trap", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "See", " ", "usage", "s", " ", "for", " ", "example", "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_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Applica", "tion", "Data", "Sou", "rce", "UI", "Helper_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "enable", "\\u", "cases_", "=_", "True_", ",_", "enable", "\\u", "forms_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "all", "\\u", "sources_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "enable", "\\u", "cases_", "=_", "enable", "\\u", "cases_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "enable", "\\u", "forms_", "=_", "enable", "\\u", "forms_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source", "\\u", "choices_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "enable", "\\u", "cases_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "source", "\\u", "choices_", "._", "append_", "(_", "(_", "\"", "case", "\"_", ",_", "\\u_", "(_", "\"", "Case", "\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "enable", "\\u", "forms_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "source", "\\u", "choices_", "._", "append_", "(_", "(_", "\"", "form", "\"_", ",_", "\\u_", "(_", "\"", "Form", "\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "applica", "tion", "\\u", "field_", "=_", "forms_", "._", "Choi", "ce", "Field_", "(_", "label_", "=_", "\\u_", "(_", "'", "Applica", "tion", "'_", ")_", ",_", "widget_", "=_", "forms_", "._", "Select_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "enable", "\\u", "cases_", "and_", "enable", "\\u", "forms_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "source", "\\u", "type", "\\u", "field_", "=_", "forms_", "._", "Choi", "ce", "Field_", "(_", "label_", "=_", "\\u_", "(_", "'", "Type", " ", "of", " ", "Data", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "choices_", "=_", "source", "\\u", "choices_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "widget_", "=_", "forms_", "._", "Select_", "(_", "choices_", "=_", "source", "\\u", "choices_", ")_", ")_", "\\u\\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_", "._", "source", "\\u", "type", "\\u", "field_", "=_", "forms_", "._", "Choi", "ce", "Field_", "(_", "choices_", "=_", "source", "\\u", "choices_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "widget_", "=_", "forms_", "._", "Hi", "dde", "n", "Input_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "initial_", "=_", "source", "\\u", "choices_", "[_", "0_", "]_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "source", "\\u", "field_", "=_", "forms_", "._", "Choi", "ce", "Field_", "(_", "label_", "=_", "\\u_", "(_", "'", "Data", " ", "Sou", "rce", "'_", ")_", ",_", "widget_", "=_", "forms_", "._", "Select_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Applica", "tion", "Data", "Sou", "rce", "UI", "Helper_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "bootstrap_", "(_", "self_", ",_", "domain_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "all", "\\u", "sources_", "=_", "get", "\\u", "app", "\\u", "sources_", "(_", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "applica", "tion", "\\u", "field_", "._", "choices_", "=_", "sorted_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "(_", "app", "\\u", "id_", ",_", "source_", "[_", "'", "name", "'_", "]_", ")_", "for_", "app", "\\u", "id_", ",_", "source_", "in_", "self_", "._", "all", "\\u", "sources_", "._", "items_", "(_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "key_", "=_", "lambda_", "id", "\\u", "name", "\\u", "tuple_", ":_", "(_", "id", "\\u", "name", "\\u", "tuple_", "[_", "1_", "]_", "or_", "''_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "source", "\\u", "field_", "._", "choices_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "add", "\\u", "choices_", "(_", "field_", ",_", "choices_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field_", "._", "choices_", "._", "extend_", "(_", "choices_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "it", "'", "s", " ", "weird", "/", "anno", "ying", " ", "tha", "t", " ", "you", " ", "have", " ", "to", " ", "manu", "ally", " ", "sync", " ", "these", "_", "\\u\\u\\uNL\\u\\u\\u_", "field_", "._", "widget_", "._", "choices_", "._", "extend_", "(_", "choices_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "enable", "\\u", "cases_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "add", "\\u", "choices_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "source", "\\u", "field_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "(_", "ct_", "[_", "'", "value", "'_", "]_", ",_", "ct_", "[_", "'", "text", "'_", "]_", ")_", "for_", "app_", "in_", "self_", "._", "all", "\\u", "sources_", "._", "values_", "(_", ")_", "for_", "ct_", "in_", "app_", "[_", "'", "case", "'_", "]_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "enable", "\\u", "forms_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "add", "\\u", "choices_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "source", "\\u", "field_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "(_", "ct_", "[_", "'", "value", "'_", "]_", ",_", "ct_", "[_", "'", "text", "'_", "]_", ")_", "for_", "app_", "in_", "self_", "._", "all", "\\u", "sources_", "._", "values_", "(_", ")_", "for_", "ct_", "in_", "app_", "[_", "'", "form", "'_", "]_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NOTE", ":", " ", "Thi", "s", " ", "correspond", "s", " ", "to", " ", "a", " ", "view", "-", "model", " ", "tha", "t", " ", "must", " ", "be", " ", "initialize", "d", " ", "in", " ", "your", " ", "template", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "doc", " ", "string", " ", "of", " ", "this", " ", "class", " ", "for", " ", "more", " ", "informati", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "applica", "tion", "\\u", "field_", "._", "widget_", "._", "attrs_", "=_", "{_", "'", "data", "-", "bind", "'_", ":_", "'", "value", ":", " ", "applica", "tion", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "source", "\\u", "type", "\\u", "field_", "._", "widget_", "._", "attrs_", "=_", "{_", "'", "data", "-", "bind", "'_", ":_", "'", "value", ":", " ", "source", "Type", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "source", "\\u", "field_", "._", "widget_", "._", "attrs_", "=_", "{_", "'", "data", "-", "bind", "'_", ":_", "'''", "\\", "10", ";", " ", " ", " ", " ", "options", ":", " ", "source", "s", "Map", "[", "applica", "tion", "()]", "[", "source", "Type", "()]", ",", "\\", "10", ";", " ", " ", " ", " ", "options", "Text", ":", " ", "function", "(", "item", "){", "return", " ", "item", ".", "text", "},", "\\", "10", ";", " ", " ", " ", " ", "options", "Value", ":", " ", "function", "(", "item", "){", "return", " ", "item", ".", "value", "}", "\\", "10", ";", " ", " ", " ", " ", "'''_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Applica", "tion", "Data", "Sou", "rce", "UI", "Helper_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "fields_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fields_", "=_", "collections_", "._", "Order", "ed", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "[_", "'", "source", "\\u", "type", "'_", "]_", "=_", "self_", "._", "source", "\\u", "type", "\\u", "field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "[_", "'", "applica", "tion", "'_", "]_", "=_", "self_", "._", "applica", "tion", "\\u", "field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "[_", "'", "source", "'_", "]_", "=_", "self_", "._", "source", "\\u", "field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "fields_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Applica", "tion", "Data", "Sou", "rce", "UI", "Helper_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "app", "\\u", "source_", "(_", "self_", ",_", "data\\u", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Applica", "tion", "Data", "Source_", "(_", "data\\u", "dict_", "[_", "'", "applica", "tion", "'_", "]_", ",_", "data\\u", "dict_", "[_", "'", "source", "\\u", "type", "'_", "]_", ",_", "data\\u", "dict_", "[_", "'", "source", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "app", "\\u", "sources_", "(_", "domain_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "apps_", "=_", "get", "\\u", "apps", "\\u", "in", "\\u", "domain_", "(_", "domain_", ",_", "include", "\\u", "remote_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "app_", "._", "\\u", "id_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "app_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "case", "\"_", ":_", "[_", "{_", "\"", "text", "\"_", ":_", "t_", ",_", "\"", "value", "\"_", ":_", "t_", "}_", "for_", "t_", "in_", "app_", "._", "get", "\\u", "case", "\\u", "types_", "(_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "form", "\"_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "text", "\"_", ":_", "u", "'{}", " ", "/", " ", "{}'_", "._", "format_", "(_", "form_", "._", "get", "\\u", "module_", "(_", ")_", "._", "default", "\\u", "name_", "(_", ")_", ",_", "form_", "._", "default", "\\u", "name_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "value", "\"_", ":_", "form_", "._", "get", "\\u", "unique", "\\u", "id_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "for_", "form_", "in_", "app_", "._", "get", "\\u", "forms_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "app_", "in_", "apps_", "\\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_", "Applica", "tion", "Data", "RM", "IH", "elp", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Applica", "tion", "Data", "RM", "IH", "elp", "er", " ", "is", " ", "mean", "t", " ", "to", " ", "generat", "e", " ", "the", " ", "response", " ", "for", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "django", "RM", "I", " ", "method", "s", " ", "require", "d", " ", "to", " ", "initialize", " ", "form", " ", "controlle", "d", " ", "by", "\\", "10", ";", " ", " ", " ", " ", "hq", ".", "app", "\\u", "data\\u", "drill", "down", ".", "ng", ".", "js", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "e", " ", "/", " ", "todo", ":", " ", "Thi", "s", " ", "Help", "er", " ", "shou", "ld", " ", "be", " ", "merge", "d", " ", "with", " ", "Applica", "tion", "Data", "Sou", "rce", "UI", "Help", "er", ".", "\\", "10", ";", " ", " ", " ", " ", "Hold", "ing", " ", "off", " ", "to", " ", "a", " ", "different", " ", "PR", ",", " ", "as", " ", "I", " ", "want", " ", "to", " ", "isolate", " ", "QA", " ", "to", " ", "just", " ", "the", " ", "export", "s", "\\", "10", ";", " ", " ", " ", " ", "(", "the", " ", "first", " ", "thing", " ", "to", " ", "use", " ", "this", ")", " ", "--", "Bi", "ye", "un", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "UNK", "NOW", "N", "\\u", "SOURCE_", "=_", "'\\u", "unknown", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "APP", "\\u", "TYPE", "\\u", "ALL_", "=_", "'", "all", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "APP", "\\u", "TYPE", "\\u", "DELETED", "_", "=_", "'", "delete", "d", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "APP", "\\u", "TYPE", "\\u", "REMO", "TE_", "=_", "'", "remote", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "APP", "\\u", "TYPE", "\\u", "NONE_", "=_", "'", "no", "\\u", "app", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "APP", "\\u", "TYPE", "\\u", "UNKNOWN_", "=_", "'", "unknown", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Applica", "tion", "Data", "RM", "IH", "elp", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "domain_", ",_", "as", "\\u", "dict_", "=_", "True_", ",_", "form", "\\u", "placeholders_", "=_", "None_", ",_", "case", "\\u", "placeholders_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "domain_", "=_", "domain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "as", "\\u", "dict_", "=_", "as", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "form", "\\u", "placeholder_", "=_", "App", "Form", "RM", "IP", "lace", "holder_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "application_", "=_", "\\u_", "(_", "\"", "Select", " ", "Applica", "tion", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "module_", "=_", "\\u_", "(_", "\"", "Select", " ", "Modul", "e", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "form_", "=_", "\\u_", "(_", "\"", "Select", " ", "Form", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "form", "\\u", "placeholders_", "=_", "form", "\\u", "placeholders_", "or_", "default", "\\u", "form", "\\u", "placeholder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "case", "\\u", "placeholder_", "=_", "App", "Case", "RM", "IP", "lace", "holder_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "application_", "=_", "\\u_", "(_", "\"", "Select", " ", "Applica", "tion", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "case", "\\u", "type_", "=_", "\\u_", "(_", "\"", "Select", " ", "Case", " ", "Type", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "case", "\\u", "placeholders_", "=_", "case", "\\u", "placeholders_", "or_", "default", "\\u", "case", "\\u", "placeholder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "as", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "form", "\\u", "placeholders_", "=_", "self_", "._", "form", "\\u", "placeholders_", "._", "\\u", "asd", "ict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "case", "\\u", "placeholders_", "=_", "self_", "._", "case", "\\u", "placeholders_", "._", "\\u", "asd", "ict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Applica", "tion", "Data", "RM", "IH", "elp", "er_", "(_", "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", "get", "\\u", "unknown", "\\u", "form", "\\u", "possibilit", "ies_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "possibilit", "ies_", "=_", "collections_", "._", "defaultdict_", "(_", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "app_", "in_", "get", "\\u", "export", "s", "\\u", "by", "\\u", "application_", "(_", "self_", "._", "domain_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "index", " ", "by", " ", "xmlns_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "app_", "[_", "'", "value", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "[_", "'", "has", "\\u", "app", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "possibilit", "ies_", "[_", "app_", "[_", "'", "key", "'_", "]_", "[_", "2_", "]_", "]_", "._", "append_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "possibilit", "ies_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Applica", "tion", "Data", "RM", "IH", "elp", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "attach", "\\u", "unknown", "\\u", "suggestions_", "(_", "self_", ",_", "unknown", "\\u", "forms_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "If", " ", "there", " ", "are", " ", "any", " ", "unknown", " ", "forms", ",", " ", "try", " ", "and", " ", "find", " ", "the", " ", "best", " ", "possib", "le", " ", "matche", "s", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "delete", "d", " ", "apps", " ", "or", " ", "copie", "d", " ", "apps", ".", " ", "If", " ", "no", " ", "suggestion", " ", "is", " ", "found", ",", " ", "say", " ", "so", "\\", "10", ";", " ", " ", " ", " ", "but", " ", "provide", " ", "the", " ", "xml", "ns", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "unknown", "\\u", "forms_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "possibilit", "ies_", "=_", "self_", "._", "\\u", "get", "\\u", "unknown", "\\u", "form", "\\u", "possibilit", "ies_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "App", "Cache_", "(_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "domain_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "super_", "(_", "App", "Cache_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "domain_", "=_", "domain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "getitem\\u\\u_", "(_", "self_", ",_", "item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "item_", "not_", "in_", "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_", "[_", "item_", "]_", "=_", "get", "\\u", "app_", "(_", "app", "\\u", "id_", "=_", "item_", ",_", "domain_", "=_", "self_", "._", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Http404_", ":_", "\\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_", "super_", "(_", "App", "Cache_", ",_", "self_", ")_", "._", "\\u\\u", "getitem\\u\\u_", "(_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "app", "\\u", "cache_", "=_", "App", "Cache_", "(_", "self_", "._", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "form_", "in_", "unknown", "\\u", "forms_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "form_", "[_", "'", "app", "'_", "]_", "[_", "'", "id", "'_", "]_", ":_", "\\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 ", " ", " _", "app_", "=_", "app", "\\u", "cache_", "[_", "form_", "[_", "'", "app", "'_", "]_", "[_", "'", "id", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "[_", "'", "has", "\\u", "app", "'_", "]_", "=_", "True_", "\\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 ", " ", " _", "form_", "[_", "'", "app", "\\u", "doe", "s", "\\u", "not", "\\u", "exist", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "[_", "'", "possibilit", "ies", "'_", "]_", "=_", "possibilit", "ies_", "[_", "form_", "[_", "'", "xml", "ns", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "form_", "[_", "'", "possibilit", "ies", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "form_", "[_", "'", "duplicat", "e", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "app_", "._", "domain_", "!=_", "self_", "._", "domain_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "logging_", "._", "error_", "(_", "\"", "subm", "ission", " ", "tagg", "ed", " ", "with", " ", "app", " ", "from", " ", "wrong", " ", "domain", ":", " ", "%", "s", "\"_", "%_", "app_", "._", "get", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "app_", "._", "copy", "\\u", "of_", ":_", "\\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 ", " ", " _", "app_", "=_", "app", "\\u", "cache_", "[_", "app_", "._", "copy", "\\u", "of_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "[_", "'", "app", "\\u", "copy", "'_", "]_", "=_", "{_", "'", "id", "'_", ":_", "app_", "._", "get", "\\u", "id_", ",_", "'", "name", "'_", ":_", "app_", "._", "name_", "}_", "\\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 ", " ", " _", "form_", "[_", "'", "app", "\\u", "copy", "'_", "]_", "=_", "{_", "'", "id", "'_", ":_", "app_", "._", "copy", "\\u", "of_", ",_", "'", "name", "'_", ":_", "'?'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "app_", "._", "is", "\\u", "deleted_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "form_", "[_", "'", "app", "\\u", "delete", "d", "'_", "]_", "=_", "{_", "'", "id", "'_", ":_", "app_", "._", "get", "\\u", "id_", "}_", "\\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 ", " ", " _", "app", "\\u", "forms_", "=_", "app_", "._", "get", "\\u", "xml", "ns", "\\u", "map_", "(_", ")_", "[_", "form_", "[_", "'", "xml", "ns", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "it", "'", "s", " ", "a", " ", "remote", " ", "app_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "app", "\\u", "forms_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "[_", "'", "has", "\\u", "app", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "app", "\\u", "forms_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "app", "\\u", "form_", "=_", "app", "\\u", "forms_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "app", "\\u", "form_", "._", "doc", "\\u", "type_", "==_", "'", "User", "Registration", "Form", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "form_", "[_", "'", "is", "\\u", "user", "\\u", "registration", "'_", "]_", "=_", "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 ", " ", " _", "app", "\\u", "module_", "=_", "app", "\\u", "form_", "._", "get", "\\u", "module_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "[_", "'", "module", "'_", "]_", "=_", "app", "\\u", "module_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "[_", "'", "form", "'_", "]_", "=_", "app", "\\u", "form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "form_", "[_", "'", "show", "\\u", "xml", "ns", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "form_", "._", "get_", "(_", "'", "app", "\\u", "copy", "'_", ")_", "and_", "not_", "form_", "._", "get_", "(_", "'", "app", "\\u", "delete", "d", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "form_", "[_", "'", "no", "\\u", "suggestions", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "app_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "form_", "[_", "'", "app", "'_", "]_", "=_", "{_", "'", "id", "'_", ":_", "app_", "._", "get", "\\u", "id_", ",_", "'", "name", "'_", ":_", "app_", "._", "name_", ",_", "'", "lang", "s", "'_", ":_", "app_", "._", "langs_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "form_", "[_", "'", "possibilit", "ies", "'_", "]_", "=_", "possibilit", "ies_", "[_", "form_", "[_", "'", "xml", "ns", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "form_", "[_", "'", "possibilit", "ies", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "form_", "[_", "'", "duplicat", "e", "'_", "]_", "=_", "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 ", " ", " _", "form_", "[_", "'", "no", "\\u", "suggestions", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "unknown", "\\u", "forms_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Applica", "tion", "Data", "RM", "IH", "elp", "er_", "(_", "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_", "\\u", "sor", "key", "\\u", "form_", "(_", "form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app", "\\u", "id_", "=_", "form_", "[_", "'", "app", "'_", "]_", "[_", "'", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "form_", "._", "get_", "(_", "'", "has", "\\u", "app", "'_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "order_", "=_", "0_", "if_", "not_", "form_", "._", "get_", "(_", "'", "app", "\\u", "delete", "d", "'_", ")_", "else_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app", "\\u", "name_", "=_", "form_", "[_", "'", "app", "'_", "]_", "[_", "'", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module_", "=_", "form_", "._", "get_", "(_", "'", "module", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "module_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "module", " ", "is", " ", "somet", "imes", " ", "wrapp", "ed", " ", "json", ",", " ", "somet", "imes", " ", "a", " ", "dict", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "module", "\\u", "id_", "=_", "module_", "[_", "'", "id", "'_", "]_", "if_", "'", "id", "'_", "in_", "module_", "else_", "module_", "._", "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 ", " _", "module", "\\u", "id_", "=_", "-_", "1_", "if_", "form_", "._", "get_", "(_", "'", "is", "\\u", "user", "\\u", "registration", "'_", ")_", "else_", "1000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "app", "\\u", "form_", "=_", "form_", "._", "get_", "(_", "'", "form", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "app", "\\u", "form_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "app", "\\u", "form", " ", "is", " ", "somet", "imes", " ", "wrapp", "ed", " ", "json", ",", " ", "somet", "imes", " ", "a", " ", "dict", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form", "\\u", "id_", "=_", "app", "\\u", "form_", "[_", "'", "id", "'_", "]_", "if_", "'", "id", "'_", "in_", "app", "\\u", "form_", "else_", "app", "\\u", "form_", "._", "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 ", " _", "form", "\\u", "id_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "order_", ",_", "app", "\\u", "name_", ",_", "app", "\\u", "id_", ",_", "module", "\\u", "id_", ",_", "form", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form", "\\u", "xmlns_", "=_", "form_", "[_", "'", "xml", "ns", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "2_", ",_", "form", "\\u", "xmlns_", ",_", "app", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Applica", "tion", "Data", "RM", "IH", "elp", "er_", "(_", "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_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "memoized", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "all", "\\u", "forms_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "forms_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unknown", "\\u", "forms_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "f_", "in_", "get", "\\u", "export", "s", "\\u", "by", "\\u", "form_", "(_", "self_", "._", "domain_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "=_", "f_", "[_", "'", "value", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "form_", "._", "get_", "(_", "'", "app", "\\u", "delete", "d", "'_", ")_", "and_", "not_", "form_", "._", "get_", "(_", "'", "subm", "ission", "s", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "app", "'_", "in_", "form_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "[_", "'", "has", "\\u", "app", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "forms_", "._", "append_", "(_", "form_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app", "\\u", "id_", "=_", "f_", "[_", "'", "key", "'_", "]_", "[_", "1_", "]_", "or_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "[_", "'", "app", "'_", "]_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "app", "\\u", "id_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "[_", "'", "has", "\\u", "app", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "[_", "'", "show", "\\u", "xml", "ns", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unknown", "\\u", "forms_", "._", "append_", "(_", "form_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "forms_", "._", "extend_", "(_", "self_", "._", "\\u", "attach", "\\u", "unknown", "\\u", "suggestions_", "(_", "unknown", "\\u", "forms_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "sorted_", "(_", "forms_", ",_", "key_", "=_", "self_", "._", "\\u", "sor", "key", "\\u", "form_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Applica", "tion", "Data", "RM", "IH", "elp", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "memoized", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "no", "\\u", "app", "\\u", "forms_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "filter_", "(_", "lambda_", "f_", ":_", "not_", "f_", "._", "get_", "(_", "'", "has", "\\u", "app", "'_", ",_", "False_", ")_", ",_", "self_", "._", "\\u", "all", "\\u", "forms_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Applica", "tion", "Data", "RM", "IH", "elp", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "memoized", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "remote", "\\u", "app", "\\u", "forms_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "filter_", "(_", "lambda_", "f_", ":_", "f_", "._", "get_", "(_", "'", "has", "\\u", "app", "'_", ",_", "False_", ")_", "and_", "f_", "._", "get_", "(_", "'", "show", "\\u", "xml", "ns", "'_", ",_", "False_", ")_", ",_", "self_", "._", "\\u", "all", "\\u", "forms_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Applica", "tion", "Data", "RM", "IH", "elp", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "memoized", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "delete", "d\\u", "app", "\\u", "forms_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "lambda_", "f_", ":_", "f_", "._", "get_", "(_", "'", "has", "\\u", "app", "'_", ",_", "False_", ")_", "and_", "f_", "._", "get_", "(_", "'", "app", "\\u", "delete", "d", "'_", ")_", "and_", "not_", "f_", "._", "get_", "(_", "'", "show", "\\u", "xml", "ns", "'_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "all", "\\u", "forms_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Applica", "tion", "Data", "RM", "IH", "elp", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "memoized", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "avail", "able", "\\u", "app", "\\u", "forms_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "lambda_", "f_", ":_", "f_", "._", "get_", "(_", "'", "has", "\\u", "app", "'_", ",_", "False_", ")_", "and_", "not_", "f_", "._", "get_", "(_", "'", "app", "\\u", "delete", "d", "'_", ")_", "and_", "not_", "f_", "._", "get_", "(_", "'", "show", "\\u", "xml", "ns", "'_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "all", "\\u", "forms_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Applica", "tion", "Data", "RM", "IH", "elp", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "memoized", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "unknown", "\\u", "forms_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "itertools_", "._", "chain_", "(_", "self_", "._", "\\u", "delete", "d\\u", "app", "\\u", "forms_", ",_", "self_", "._", "\\u", "remote", "\\u", "app", "\\u", "forms_", ",_", "self_", "._", "\\u", "no", "\\u", "app", "\\u", "forms_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Applica", "tion", "Data", "RM", "IH", "elp", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "app", "\\u", "type", "\\u", "choices_", "(_", "self_", ",_", "as", "\\u", "dict_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "choices_", "=_", "[_", "(_", "\\u_", "(_", "\"", "Applica", "tion", "s", "\"_", ")_", ",_", "self_", "._", "APP", "\\u", "TYPE", "\\u", "ALL_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "remote", "\\u", "app", "\\u", "forms_", "or_", "self_", "._", "\\u", "delete", "d\\u", "app", "\\u", "forms_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "choices_", "._", "append_", "(_", "(_", "\\u_", "(_", "\"", "Un", "know", "n", "\"_", ")_", ",_", "self_", "._", "APP", "\\u", "TYPE", "\\u", "UNKNOWN_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "choices_", "=_", "map_", "(_", "lambda_", "c_", ":_", "RM", "ID", "ata", "Choice_", "(_", "id_", "=_", "c_", "[_", "1_", "]_", ",_", "text_", "=_", "c_", "[_", "0_", "]_", ",_", "data_", "=_", "{_", "}_", ")_", ",_", "choices_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "as", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "choices_", "=_", "map_", "(_", "lambda_", "c_", ":_", "c_", "._", "\\u", "asd", "ict_", "(_", ")_", ",_", "choices_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "choices_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Applica", "tion", "Data", "RM", "IH", "elp", "er_", "(_", "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_", "\\u", "get", "\\u", "unique", "\\u", "choices_", "(_", "choices_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "final", "\\u", "choices_", "=_", "collections_", "._", "defaultdict_", "(_", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", ",_", "val", "\\u", "list_", "in_", "choices_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "val", "\\u", "ids_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "final", "\\u", "choices_", "[_", "k_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "v_", "in_", "val", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "v_", "._", "id_", "not_", "in_", "new", "\\u", "val", "\\u", "ids_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "new", "\\u", "val", "\\u", "ids_", "._", "append_", "(_", "v_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "final", "\\u", "choices_", "[_", "k_", "]_", "._", "append_", "(_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "final", "\\u", "choices_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Applica", "tion", "Data", "RM", "IH", "elp", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "applica", "tion", "s", "\\u", "by", "\\u", "type_", "(_", "self_", ",_", "as", "\\u", "dict_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "apps", "\\u", "by", "\\u", "type_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "APP", "\\u", "TYPE", "\\u", "ALL_", ",_", "self_", "._", "\\u", "avail", "able", "\\u", "app", "\\u", "forms_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "APP", "\\u", "TYPE", "\\u", "UNKNOWN_", ",_", "self_", "._", "\\u", "unknown", "\\u", "forms_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "app", "\\u", "fmt_", "=_", "lambda_", "c_", ":_", "(_", "c_", "[_", "0_", "]_", ",_", "map_", "(_", "lambda_", "f_", ":_", "RM", "ID", "ata", "Choice_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "[_", "'", "app", "'_", "]_", "[_", "'", "id", "'_", "]_", "if_", "f_", "._", "get_", "(_", "'", "has", "\\u", "app", "'_", ",_", "False_", ")_", "else_", "self_", "._", "UNK", "NOW", "N", "\\u", "SOURCE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "[_", "'", "app", "'_", "]_", "[_", "'", "name", "'_", "]_", "if_", "f_", "._", "get_", "(_", "'", "has", "\\u", "app", "'_", ",_", "False_", ")_", "else_", "\\u_", "(_", "\"", "Un", "know", "n", " ", "Applica", "tion", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "c_", "[_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "apps", "\\u", "by", "\\u", "type_", "=_", "map_", "(_", "\\u", "app", "\\u", "fmt_", ",_", "apps", "\\u", "by", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "apps", "\\u", "by", "\\u", "type_", "=_", "dict_", "(_", "apps", "\\u", "by", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "apps", "\\u", "by", "\\u", "type_", "=_", "self_", "._", "\\u", "get", "\\u", "unique", "\\u", "choices_", "(_", "apps", "\\u", "by", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "include", " ", "restore", " ", "URL", " ", "for", " ", "delete", "d", " ", "apps_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "app_", "in_", "apps", "\\u", "by", "\\u", "type_", "[_", "self_", "._", "APP", "\\u", "TYPE", "\\u", "DELETED", "_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "._", "data_", "[_", "'", "restore", "Ur", "l", "'_", "]_", "=_", "reverse_", "(_", "'", "view", "\\u", "app", "'_", ",_", "args_", "=_", "[_", "self_", "._", "domain_", ",_", "app_", "._", "id_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "as", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "apps", "\\u", "by", "\\u", "type_", "=_", "self_", "._", "\\u", "map", "\\u", "chosen", "\\u", "by", "\\u", "choice", "\\u", "as", "\\u", "dict_", "(_", "apps", "\\u", "by", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "apps", "\\u", "by", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Applica", "tion", "Data", "RM", "IH", "elp", "er_", "(_", "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_", "\\u", "map", "\\u", "chosen", "\\u", "by", "\\u", "choice", "\\u", "as", "\\u", "dict_", "(_", "chosen", "\\u", "by", "\\u", "choice_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "k_", ",_", "v_", "in_", "chosen", "\\u", "by", "\\u", "choice_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "chosen", "\\u", "by", "\\u", "choice_", "[_", "k_", "]_", "=_", "map_", "(_", "lambda_", "f_", ":_", "f_", "._", "\\u", "asd", "ict_", "(_", ")_", ",_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "chosen", "\\u", "by", "\\u", "choice_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Applica", "tion", "Data", "RM", "IH", "elp", "er_", "(_", "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_", "\\u", "get", "\\u", "item", "\\u", "name_", "(_", "item_", ",_", "has", "\\u", "app_", ",_", "app", "\\u", "lang_", ",_", "default", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "item", "\\u", "name_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "has", "\\u", "app_", "and_", "item_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "item", "\\u", "name_", "=_", "item_", "[_", "'", "name", "'_", "]_", "._", "get_", "(_", "app", "\\u", "lang_", ")_", "or_", "item_", "[_", "'", "name", "'_", "]_", "._", "get_", "(_", "'", "en", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "item", "\\u", "name_", "or_", "default", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Applica", "tion", "Data", "RM", "IH", "elp", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "module", "s", "\\u", "and", "\\u", "forms_", "(_", "self_", ",_", "as", "\\u", "dict_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "module", "s", "\\u", "by", "\\u", "app_", "=_", "collections_", "._", "defaultdict_", "(_", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "forms", "\\u", "by", "\\u", "app", "\\u", "by", "\\u", "module_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "form_", "in_", "self_", "._", "\\u", "all", "\\u", "forms_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "has", "\\u", "app_", "=_", "form_", "._", "get_", "(_", "'", "has", "\\u", "app", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app", "\\u", "lang_", "=_", "form_", "[_", "'", "app", "'_", "]_", "[_", "'", "lang", "s", "'_", "]_", "[_", "0_", "]_", "if_", "'", "lang", "s", "'_", "in_", "form_", "[_", "'", "app", "'_", "]_", "else_", "'", "en", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app", "\\u", "id_", "=_", "form_", "[_", "'", "app", "'_", "]_", "[_", "'", "id", "'_", "]_", "if_", "has", "\\u", "app_", "else_", "self_", "._", "UNK", "NOW", "N", "\\u", "SOURCE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module_", "=_", "form_", "._", "get_", "(_", "'", "module", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module", "\\u", "id_", "=_", "(_", "module_", "[_", "'", "id", "'_", "]_", "if_", "has", "\\u", "app_", "and_", "module_", "is_", "not_", "None_", "\\u\\u\\uNL\\u\\u\\u_", "else_", "self_", "._", "UNK", "NOW", "N", "\\u", "SOURCE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module", "\\u", "name_", "=_", "self_", "._", "\\u", "get", "\\u", "item", "\\u", "name_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "module_", ",_", "has", "\\u", "app_", ",_", "app", "\\u", "lang_", ",_", "\\u_", "(_", "\"", "Un", "know", "n", " ", "Modul", "e", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form", "\\u", "xmlns_", "=_", "form_", "[_", "'", "xml", "ns", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form", "\\u", "name_", "=_", "form", "\\u", "xmlns_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "form_", "._", "get_", "(_", "'", "show", "\\u", "xml", "ns", "'_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form", "\\u", "name_", "=_", "self_", "._", "\\u", "get", "\\u", "item", "\\u", "name_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "form_", "._", "get_", "(_", "'", "form", "'_", ")_", ",_", "has", "\\u", "app_", ",_", "app", "\\u", "lang_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"{}", " ", "(", "potenti", "al", " ", "matche", "s", ")\"_", "._", "format_", "(_", "form", "\\u", "xmlns_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "module", "\\u", "choice_", "=_", "RM", "ID", "ata", "Choice_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "module", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "module", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "form_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form", "\\u", "choice_", "=_", "RM", "ID", "ata", "Choice_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "form", "\\u", "xmlns_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "form", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "form_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "as", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form", "\\u", "choice_", "=_", "form", "\\u", "choice_", "._", "\\u", "asd", "ict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "app", "\\u", "id_", "not_", "in_", "forms", "\\u", "by", "\\u", "app", "\\u", "by", "\\u", "module_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "forms", "\\u", "by", "\\u", "app", "\\u", "by", "\\u", "module_", "[_", "app", "\\u", "id_", "]_", "=_", "collections_", "._", "defaultdict_", "(_", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "module", "s", "\\u", "by", "\\u", "app_", "[_", "app", "\\u", "id_", "]_", "._", "append_", "(_", "module", "\\u", "choice_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "forms", "\\u", "by", "\\u", "app", "\\u", "by", "\\u", "module_", "[_", "app", "\\u", "id_", "]_", "[_", "module", "\\u", "id_", "]_", "._", "append_", "(_", "form", "\\u", "choice_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "module", "s", "\\u", "by", "\\u", "app_", "=_", "self_", "._", "\\u", "get", "\\u", "unique", "\\u", "choices_", "(_", "module", "s", "\\u", "by", "\\u", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "as", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "module", "s", "\\u", "by", "\\u", "app_", "=_", "self_", "._", "\\u", "map", "\\u", "chosen", "\\u", "by", "\\u", "choice", "\\u", "as", "\\u", "dict_", "(_", "module", "s", "\\u", "by", "\\u", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "module", "s", "\\u", "by", "\\u", "app_", ",_", "forms", "\\u", "by", "\\u", "app", "\\u", "by", "\\u", "module_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Applica", "tion", "Data", "RM", "IH", "elp", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "form", "\\u", "rmi", "\\u", "response_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Us", "e", " ", "this", " ", "to", " ", "generat", "e", " ", "the", " ", "response", " ", "tha", "t", " ", "initialize", "s", " ", "the", " ", "form", "\\", "10", ";", " ", " ", " ", " ", "controlle", "d", " ", "by", " ", "hq", ".", "app", "\\u", "data\\u", "drill", "down", ".", "ng", ".", "js", " ", "if", " ", "you", " ", "are", " ", "drill", "ing", " ", "down", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "an", " ", "XF", "orm", " ", "+", " ", "app", "\\u", "id", " ", "pair", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module", "s", "\\u", "by", "\\u", "app_", ",_", "forms", "\\u", "by", "\\u", "app", "\\u", "by", "\\u", "module_", "=_", "self_", "._", "\\u", "get", "\\u", "module", "s", "\\u", "and", "\\u", "forms_", "(_", "self_", "._", "as", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "App", "Form", "RM", "IR", "esp", "ons", "e_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "types_", "=_", "self_", "._", "\\u", "get", "\\u", "app", "\\u", "type", "\\u", "choices_", "(_", "self_", "._", "as", "\\u", "dict_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "apps", "\\u", "by", "\\u", "type_", "=_", "self_", "._", "\\u", "get", "\\u", "applica", "tion", "s", "\\u", "by", "\\u", "type_", "(_", "self_", "._", "as", "\\u", "dict_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "module", "s", "\\u", "by", "\\u", "app_", "=_", "module", "s", "\\u", "by", "\\u", "app_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "forms", "\\u", "by", "\\u", "app", "\\u", "by", "\\u", "module_", "=_", "forms", "\\u", "by", "\\u", "app", "\\u", "by", "\\u", "module_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "placeholders_", "=_", "self_", "._", "form", "\\u", "placeholders_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "as", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "response_", "._", "\\u", "asd", "ict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Applica", "tion", "Data", "RM", "IH", "elp", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "case", "s", "\\u", "for", "\\u", "apps_", "(_", "self_", ",_", "apps", "\\u", "by", "\\u", "type_", ",_", "as", "\\u", "dict_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "used", "\\u", "case", "\\u", "types_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "case", "\\u", "types", "\\u", "by", "\\u", "app_", "=_", "collections_", "._", "defaultdict_", "(_", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "app", "\\u", "type_", ",_", "apps_", "in_", "apps", "\\u", "by", "\\u", "type_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "app", "\\u", "choice_", "in_", "apps_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "app", "\\u", "choice_", "._", "id_", "==_", "self_", "._", "UNK", "NOW", "N", "\\u", "SOURCE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "app_", "=_", "get", "\\u", "app_", "(_", "self_", "._", "domain_", ",_", "app", "\\u", "choice_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "case", "\\u", "types_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "app_", ",_", "'", "module", "s", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "case", "\\u", "types_", "=_", "set_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "module_", "._", "case", "\\u", "type_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "module_", "in_", "app_", "._", "modules_", "if_", "module_", "._", "case", "\\u", "type_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "used", "\\u", "case", "\\u", "types_", "=_", "used", "\\u", "case", "\\u", "types_", "._", "union_", "(_", "case", "\\u", "types_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "case", "\\u", "types_", "=_", "map_", "(_", "lambda_", "c_", ":_", "RM", "ID", "ata", "Choice_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "id_", "=_", "c_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "text_", "=_", "c_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "app", "\\u", "choice_", "._", "data_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "case", "\\u", "types_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "as", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "case", "\\u", "types_", "=_", "map_", "(_", "lambda_", "c_", ":_", "c_", "._", "\\u", "asd", "ict_", "(_", ")_", ",_", "case", "\\u", "types_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "case", "\\u", "types", "\\u", "by", "\\u", "app_", "[_", "app", "\\u", "choice_", "._", "id_", "]_", "=_", "case", "\\u", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "all", "\\u", "case", "\\u", "types_", "=_", "Case", "Accessor", "s_", "(_", "self_", "._", "domain_", ")_", "._", "get", "\\u", "case", "\\u", "types_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unknown", "\\u", "case", "\\u", "types_", "=_", "all", "\\u", "case", "\\u", "types_", "._", "difference_", "(_", "used", "\\u", "case", "\\u", "types_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unknown", "\\u", "case", "\\u", "types_", "=_", "map_", "(_", "lambda_", "c_", ":_", "RM", "ID", "ata", "Choice_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "id_", "=_", "c_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "text_", "=_", "c_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "unknown", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "unknown", "\\u", "case", "\\u", "types_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "as", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "unknown", "\\u", "case", "\\u", "types_", "=_", "map_", "(_", "lambda_", "c_", ":_", "c_", "._", "\\u", "asd", "ict_", "(_", ")_", ",_", "unknown", "\\u", "case", "\\u", "types_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "case", "\\u", "types", "\\u", "by", "\\u", "app_", "[_", "self_", "._", "UNK", "NOW", "N", "\\u", "SOURCE_", "]_", "=_", "unknown", "\\u", "case", "\\u", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "case", "\\u", "types", "\\u", "by", "\\u", "app_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Applica", "tion", "Data", "RM", "IH", "elp", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "case", "\\u", "rmi", "\\u", "response_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Us", "e", " ", "this", " ", "to", " ", "generat", "e", " ", "a", " ", "response", " ", "tha", "t", " ", "initialize", "s", " ", "the", " ", "form", "\\", "10", ";", " ", " ", " ", " ", "controlle", "d", " ", "by", " ", "hq", ".", "app", "\\u", "data\\u", "drill", "down", ".", "ng", ".", "js", " ", "if", " ", "you", " ", "are", " ", "drill", "ing", " ", "down", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "Case", " ", "Type", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "apps", "\\u", "by", "\\u", "type_", "=_", "self_", "._", "\\u", "get", "\\u", "applica", "tion", "s", "\\u", "by", "\\u", "type_", "(_", "as", "\\u", "dict_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "case", "\\u", "types", "\\u", "by", "\\u", "app_", "=_", "self_", "._", "\\u", "get", "\\u", "case", "s", "\\u", "for", "\\u", "apps_", "(_", "apps", "\\u", "by", "\\u", "type_", ",_", "self_", "._", "as", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "as", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "apps", "\\u", "by", "\\u", "type_", "=_", "self_", "._", "\\u", "map", "\\u", "chosen", "\\u", "by", "\\u", "choice", "\\u", "as", "\\u", "dict_", "(_", "apps", "\\u", "by", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "=_", "App", "Case", "RM", "IR", "esp", "ons", "e_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "types_", "=_", "self_", "._", "\\u", "get", "\\u", "app", "\\u", "type", "\\u", "choices_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "apps", "\\u", "by", "\\u", "type_", "=_", "apps", "\\u", "by", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "case", "\\u", "types", "\\u", "by", "\\u", "app_", "=_", "case", "\\u", "types", "\\u", "by", "\\u", "app_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "placeholders_", "=_", "self_", "._", "case", "\\u", "placeholders_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "as", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "response_", "._", "\\u", "asd", "ict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\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 ]
Unused import
taoliu/taolib/CoreLib/BinKeeper/__init__.py
[ { "content": "# Time-stamp: <2011-01-31 17:04:32 Tao Liu>\n\n\"\"\"Module Description: BinKeeper for Wiggle-like tracks.\n\nCopyright (c) 2008 Tao Liu <[email protected]>\n\nThis code is free software; you can redistribute it and/or modify it\nunder the terms of the BSD License (see the file COPYING included with\nthe distribution).\n\n@status: experimental\n@version: $Revision$\n@author: Tao Liu\n@contact: [email protected]\n\"\"\"\n\n# ------------------------------------\n# python modules\n# ------------------------------------\n\nimport sys\nimport re\nfrom bisect import insort,bisect_left,bisect_right\nfrom array import array\n# ------------------------------------\n# constants\n# ------------------------------------\n# to determine the byte size\nif array('H',[1]).itemsize == 2:\n BYTE2 = 'H'\nelse:\n raise Exception(\"BYTE2 type cannot be determined!\")\n\nif array('I',[1]).itemsize == 4:\n BYTE4 = 'I'\nelif array('L',[1]).itemsize == 4:\n BYTE4 = 'L'\nelse:\n raise Exception(\"BYTE4 type cannot be determined!\")\n\nif array('f',[1]).itemsize == 4:\n FBYTE4 = 'f'\nelif array('d',[1]).itemsize == 4:\n FBYTE4 = 'd'\nelse:\n raise Exception(\"BYTE4 type cannot be determined!\")\n\n# ------------------------------------\n# Misc functions\n# ------------------------------------\n\n# ------------------------------------\n# Classes\n# ------------------------------------\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class BinKeeperI:\n \"\"\"BinKeeper keeps point data from a chromosome in a bin list.\n\n Example:\n >>> from taolib.CoreLib.Parser import WiggleIO\n >>> w = WiggleIO('sample.wig')\n >>> bk = w.build_binKeeper()\n >>> bk['chrI'].pp2v(1000,2000) # to extract values in chrI:1000..2000\n \"\"\"\n\n\n\n\n\n\n\n", "metadata": "root.BinKeeperI", "header": "['module', '___EOS___']", "index": 54 }, { "content": " def __init__ (self,binsize=8000,chromosomesize=1e9):\n \"\"\"Initializer.\n\n Parameters:\n binsize : size of bin in Basepair\n chromosomesize : size of chromosome, default is 1G\n \"\"\"\n self.binsize = binsize\n self.binnumber = int(chromosomesize/self.binsize)+1\n self.cage = []\n a = self.cage.append\n for i in xrange(self.binnumber):\n a([array(BYTE4,[]),array(FBYTE4,[])])", "metadata": "root.BinKeeperI.__init__", "header": "['class', 'BinKeeperI', ':', '___EOS___']", "index": 63 }, { "content": " def add ( self, p, value ):\n \"\"\"Add a position into BinKeeper.\n\n Note: position must be sorted before adding. Otherwise, pp2v\n and pp2p will not work.\n \"\"\"\n bin = p/self.binsize\n self.cage[bin][0].append(p)\n self.cage[bin][1].append(value) ", "metadata": "root.BinKeeperI.add", "header": "['class', 'BinKeeperI', ':', '___EOS___']", "index": 77 }, { "content": " def p2bin (self, p ):\n \"\"\"Return the bin index for a position.\n \n \"\"\"\n return p/self.binsize", "metadata": "root.BinKeeperI.p2bin", "header": "['class', 'BinKeeperI', ':', '___EOS___']", "index": 87 }, { "content": " def p2cage (self, p):\n \"\"\"Return the bin containing the position.\n \n \"\"\"\n return self.cage[p/self.binsize]", "metadata": "root.BinKeeperI.p2cage", "header": "['class', 'BinKeeperI', ':', '___EOS___']", "index": 93 }, { "content": " def __pp2cages (self, p1, p2):\n assert p1<=p2\n bin1 = self.p2bin(p1)\n bin2 = self.p2bin(p2)+1\n t = [array(BYTE4,[]),array(FBYTE4,[])]\n for i in xrange(bin1,bin2):\n t[0].extend(self.cage[i][0])\n t[1].extend(self.cage[i][1]) \n return t", "metadata": "root.BinKeeperI.__pp2cages", "header": "['class', 'BinKeeperI', ':', '___EOS___']", "index": 99 }, { "content": " def pp2p (self, p1, p2):\n \"\"\"Give the position list between two given positions.\n\n Parameters:\n p1 : start position\n p2 : end position\n Return Value:\n list of positions between p1 and p2.\n \"\"\"\n (ps,vs) = self.__pp2cages(p1,p2)\n p1_in_cages = bisect_left(ps,p1)\n p2_in_cages = bisect_right(ps,p2)\n return ps[p1_in_cages:p2_in_cages]", "metadata": "root.BinKeeperI.pp2p", "header": "['class', 'BinKeeperI', ':', '___EOS___']", "index": 109 }, { "content": " def pp2v (self, p1, p2):\n \"\"\"Give the value list between two given positions.\n\n Parameters:\n p1 : start position\n p2 : end position\n Return Value:\n list of values whose positions are between p1 and p2.\n \"\"\"\n (ps,vs) = self.__pp2cages(p1,p2)\n p1_in_cages = bisect_left(ps,p1)\n p2_in_cages = bisect_right(ps,p2)\n return vs[p1_in_cages:p2_in_cages]", "metadata": "root.BinKeeperI.pp2v", "header": "['class', 'BinKeeperI', ':', '___EOS___']", "index": 123 }, { "content": " def pp2pv (self, p1, p2):\n \"\"\"Give the (position,value) list between two given positions.\n\n Parameters:\n p1 : start position\n p2 : end position\n Return Value:\n list of (position,value) between p1 and p2.\n \"\"\"\n (ps,vs) = self.__pp2cages(p1,p2)\n p1_in_cages = bisect_left(ps,p1)\n p2_in_cages = bisect_right(ps,p2)\n return zip(ps[p1_in_cages:p2_in_cages],vs[p1_in_cages:p2_in_cages])", "metadata": "root.BinKeeperI.pp2pv", "header": "['class', 'BinKeeperI', ':', '___EOS___']", "index": 138 } ]
[ { "span": "import sys", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 10 }, { "span": "from bisect import insort,bisect_left,bisect_right", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 50 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Time", "-", "stamp", ":", " ", "<", "2011", "-0", "1", "-", "3", "1", " ", "1", "7", ":", "04", ":", "32", " ", "Ta", "o", " ", "Li", "u", ">_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Modul", "e", " ", "Descripti", "on", ":", " ", "Bin", "Keep", "er", " ", "for", " ", "Wi", "ggle", "-", "like", " ", "tracks", ".", "\\", "10", ";", "\\", "10", ";", "Copy", "right", " ", "(", "c", ")", " ", "2008", " ", "Ta", "o", " ", "Li", "u", " ", "<", "ta", "oli", "u", "@", "jim", "my", ".", "har", "vard", ".", "edu", ">", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "code", " ", "is", " ", "free", " ", "software", ";", " ", "you", " ", "can", " ", "redis", "tribut", "e", " ", "it", " ", "and", "/", "or", " ", "modif", "y", " ", "it", "\\", "10", ";", "under", " ", "the", " ", "term", "s", " ", "of", " ", "the", " ", "BS", "D", " ", "License", " ", "(", "see", " ", "the", " ", "file", " ", "COPY", "ING", " ", "include", "d", " ", "with", "\\", "10", ";", "the", " ", "distribu", "tion", ").", "\\", "10", ";", "\\", "10", ";", "@", "status", ":", " ", " ", "experimental", "\\", "10", ";", "@", "version", ":", " ", "$", "Revi", "sion", "$", "\\", "10", ";", "@", "author", ":", " ", " ", "Ta", "o", " ", "Li", "u", "\\", "10", ";", "@", "contact", ":", " ", "ta", "oli", "u", "@", "jim", "my", ".", "har", "vard", ".", "edu", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "python", " ", "modules_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bisect_", "import_", "ins", "ort_", ",_", "bisect", "\\u", "left_", ",_", "bisect", "\\u", "right_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "array_", "import_", "array_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "constants_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "dete", "rmin", "e", " ", "the", " ", "byte", " ", "size_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "array_", "(_", "'", "H", "'_", ",_", "[_", "1_", "]_", ")_", "._", "itemsize_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "BYTE", "2_", "=_", "'", "H", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "BYTE", "2", " ", "type", " ", "cann", "ot", " ", "be", " ", "dete", "rmin", "ed", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "array_", "(_", "'", "I", "'_", ",_", "[_", "1_", "]_", ")_", "._", "itemsize_", "==_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "BYTE", "4_", "=_", "'", "I", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "array_", "(_", "'", "L", "'_", ",_", "[_", "1_", "]_", ")_", "._", "itemsize_", "==_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "BYTE", "4_", "=_", "'", "L", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "BYTE", "4", " ", "type", " ", "cann", "ot", " ", "be", " ", "dete", "rmin", "ed", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "array_", "(_", "'", "f", "'_", ",_", "[_", "1_", "]_", ")_", "._", "itemsize_", "==_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "FB", "YT", "E4", "_", "=_", "'", "f", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "array_", "(_", "'", "d", "'_", ",_", "[_", "1_", "]_", ")_", "._", "itemsize_", "==_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "FB", "YT", "E4", "_", "=_", "'", "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 ", " _", "raise_", "Exception_", "(_", "\"", "BYTE", "4", " ", "type", " ", "cann", "ot", " ", "be", " ", "dete", "rmin", "ed", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Mis", "c", " ", "functions_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Classes_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Bin", "Keep", "er", "I_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Bin", "Keep", "er", " ", "keep", "s", " ", "point", " ", "data", " ", "from", " ", "a", " ", "chromo", "some", " ", "in", " ", "a", " ", "bin", " ", "list", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ple", ":", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "ta", "oli", "b", ".", "Core", "Lib", ".", "Parser", " ", "import", " ", "Wi", "ggle", "IO", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "w", " ", "=", " ", "Wi", "ggle", "IO", "('", "sample", ".", "wig", "')", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "bk", " ", "=", " ", "w", ".", "build", "\\u", "bin", "Keep", "er", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "bk", "['", "chr", "I", "']", ".", "pp", "2v", "(", "1000", ",", "2000", ")", " ", "#", " ", "to", " ", "extract", " ", "values", " ", "in", " ", "chr", "I", ":", "1000", "..", "2000", "\\", "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\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Bin", "Keep", "er", "I_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "bins", "ize_", "=_", "8000_", ",_", "chromosomes", "ize_", "=_", "1e9_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Initializer", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "bins", "ize", " ", ":", " ", "size", " ", "of", " ", "bin", " ", "in", " ", "Base", "pair", "\\", "10", ";", " ", " ", " ", " ", "chromosomes", "ize", " ", ":", " ", "size", " ", "of", " ", "chromo", "some", ",", " ", "default", " ", "is", " ", "1", "G", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bins", "ize_", "=_", "bins", "ize_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bin", "number_", "=_", "int_", "(_", "chromosomes", "ize_", "/_", "self_", "._", "bins", "ize_", ")_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cag", "e_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "self_", "._", "cag", "e_", "._", "append_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "self_", "._", "bin", "number_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "(_", "[_", "array_", "(_", "BYTE", "4_", ",_", "[_", "]_", ")_", ",_", "array_", "(_", "FB", "YT", "E4", "_", ",_", "[_", "]_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bin", "Keep", "er", "I_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add_", "(_", "self_", ",_", "p_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Add", " ", "a", " ", "position", " ", "int", "o", " ", "Bin", "Keep", "er", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "e", ":", " ", "position", " ", "must", " ", "be", " ", "sorte", "d", " ", "bef", "ore", " ", "addin", "g", ".", " ", "Ot", "her", "wis", "e", ",", " ", "pp", "2v", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "pp", "2p", " ", "will", " ", "not", " ", "work", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bin_", "=_", "p_", "/_", "self_", "._", "bins", "ize_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cag", "e_", "[_", "bin_", "]_", "[_", "0_", "]_", "._", "append_", "(_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cag", "e_", "[_", "bin_", "]_", "[_", "1_", "]_", "._", "append_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bin", "Keep", "er", "I_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "p2", "bin_", "(_", "self_", ",_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "the", " ", "bin", " ", "index", " ", "for", " ", "a", " ", "position", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "p_", "/_", "self_", "._", "bins", "ize_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bin", "Keep", "er", "I_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "p2", "cag", "e_", "(_", "self_", ",_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "the", " ", "bin", " ", "contain", "ing", " ", "the", " ", "position", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "cag", "e_", "[_", "p_", "/_", "self_", "._", "bins", "ize_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bin", "Keep", "er", "I_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "pp", "2c", "ages_", "(_", "self_", ",_", "p1_", ",_", "p2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "p1_", "<=_", "p2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bin", "1_", "=_", "self_", "._", "p2", "bin_", "(_", "p1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bin", "2_", "=_", "self_", "._", "p2", "bin_", "(_", "p2_", ")_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "[_", "array_", "(_", "BYTE", "4_", ",_", "[_", "]_", ")_", ",_", "array_", "(_", "FB", "YT", "E4", "_", ",_", "[_", "]_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "bin", "1_", ",_", "bin", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "[_", "0_", "]_", "._", "extend_", "(_", "self_", "._", "cag", "e_", "[_", "i_", "]_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "[_", "1_", "]_", "._", "extend_", "(_", "self_", "._", "cag", "e_", "[_", "i_", "]_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bin", "Keep", "er", "I_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pp", "2p", "_", "(_", "self_", ",_", "p1_", ",_", "p2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Give", " ", "the", " ", "position", " ", "list", " ", "bet", "ween", " ", "two", " ", "give", "n", " ", "position", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "p1", " ", ":", " ", "start", " ", "position", "\\", "10", ";", " ", " ", " ", " ", "p2", " ", ":", " ", "end", " ", "position", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "Value", ":", "\\", "10", ";", " ", " ", " ", " ", "list", " ", "of", " ", "position", "s", " ", "bet", "ween", " ", "p1", " ", "and", " ", "p2", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "ps_", ",_", "vs_", ")_", "=_", "self_", "._", "\\u\\u", "pp", "2c", "ages_", "(_", "p1_", ",_", "p2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p1", "\\u", "in", "\\u", "cag", "es_", "=_", "bisect", "\\u", "left_", "(_", "ps_", ",_", "p1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p2", "\\u", "in", "\\u", "cag", "es_", "=_", "bisect", "\\u", "right_", "(_", "ps_", ",_", "p2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ps_", "[_", "p1", "\\u", "in", "\\u", "cag", "es_", ":_", "p2", "\\u", "in", "\\u", "cag", "es_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bin", "Keep", "er", "I_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pp", "2v", "_", "(_", "self_", ",_", "p1_", ",_", "p2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Give", " ", "the", " ", "value", " ", "list", " ", "bet", "ween", " ", "two", " ", "give", "n", " ", "position", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "p1", " ", ":", " ", "start", " ", "position", "\\", "10", ";", " ", " ", " ", " ", "p2", " ", ":", " ", "end", " ", "position", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "Value", ":", "\\", "10", ";", " ", " ", " ", " ", "list", " ", "of", " ", "values", " ", "who", "se", " ", "position", "s", " ", "are", " ", "bet", "ween", " ", "p1", " ", "and", " ", "p2", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "ps_", ",_", "vs_", ")_", "=_", "self_", "._", "\\u\\u", "pp", "2c", "ages_", "(_", "p1_", ",_", "p2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p1", "\\u", "in", "\\u", "cag", "es_", "=_", "bisect", "\\u", "left_", "(_", "ps_", ",_", "p1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p2", "\\u", "in", "\\u", "cag", "es_", "=_", "bisect", "\\u", "right_", "(_", "ps_", ",_", "p2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "vs_", "[_", "p1", "\\u", "in", "\\u", "cag", "es_", ":_", "p2", "\\u", "in", "\\u", "cag", "es_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bin", "Keep", "er", "I_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pp", "2p", "v_", "(_", "self_", ",_", "p1_", ",_", "p2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Give", " ", "the", " ", "(", "position", ",", "value", ")", " ", "list", " ", "bet", "ween", " ", "two", " ", "give", "n", " ", "position", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "p1", " ", ":", " ", "start", " ", "position", "\\", "10", ";", " ", " ", " ", " ", "p2", " ", ":", " ", "end", " ", "position", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "Value", ":", "\\", "10", ";", " ", " ", " ", " ", "list", " ", "of", " ", "(", "position", ",", "value", ")", " ", "bet", "ween", " ", "p1", " ", "and", " ", "p2", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "ps_", ",_", "vs_", ")_", "=_", "self_", "._", "\\u\\u", "pp", "2c", "ages_", "(_", "p1_", ",_", "p2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p1", "\\u", "in", "\\u", "cag", "es_", "=_", "bisect", "\\u", "left_", "(_", "ps_", ",_", "p1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p2", "\\u", "in", "\\u", "cag", "es_", "=_", "bisect", "\\u", "right_", "(_", "ps_", ",_", "p2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "zip_", "(_", "ps_", "[_", "p1", "\\u", "in", "\\u", "cag", "es_", ":_", "p2", "\\u", "in", "\\u", "cag", "es_", "]_", ",_", "vs_", "[_", "p1", "\\u", "in", "\\u", "cag", "es_", ":_", "p2", "\\u", "in", "\\u", "cag", "es_", "]_", ")_" ]
[ 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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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 ]
Imprecise assert
globocom/tornado-es/tornadoes/tests/unit/test_tornadoes.py
[ { "content": " def test_should_make_two_searches(self):\n self._make_multisearch()\n response = self._verify_status_code_and_return_response()\n self.assertEqual(response['responses'][0]['hits']['hits'][0]['_id'], \"171171\")\n self.assertFalse(\"hits\" in response['responses'][1])", "metadata": "root.TestESConnection.test_should_make_two_searches", "header": "['class', 'TestESConnection', '(', 'ESConnectionTestBase', ')', ':', '___EOS___']", "index": 88 }, { "content": " def test_count_specific_query_with_many_parameters(self):\n source = {\"query\": {\"term\": {\"_id\": \"171171\"}}}\n source = self._set_count_query(source)\n parameters = {'df': '_id', 'test': True}\n self.es_connection.count(callback=self.stop, source=source, parameters=parameters)\n response = self.wait()\n response_dict = self._verify_response_and_returns_dict(response)\n self.assertEqual(response_dict[\"count\"], 1)\n self.assertTrue('df=_id' in response.request.url)\n self.assertTrue('test=True' in response.request.url)", "metadata": "root.TestESConnection.test_count_specific_query_with_many_parameters", "header": "['class', 'TestESConnection', '(', 'ESConnectionTestBase', ')', ':', '___EOS___']", "index": 168 }, { "content": " @gen_test\n def test_should_make_two_searches(self):\n self._make_multisearch()\n response = yield self.es_connection.apply_search()\n response = self._verify_status_code_and_return_response(response)\n\n self.assertEqual(response['responses'][0]['hits']['hits'][0]['_id'], \"171171\")\n self.assertFalse(\"hits\" in response['responses'][1])", "metadata": "root.TestESConnectionWithTornadoGen.test_should_make_two_searches", "header": "['class', 'TestESConnectionWithTornadoGen', '(', 'ESConnectionTestBase', ')', ':', '___EOS___']", "index": 221 }, { "content": " @gen_test\n def test_count_specific_query_with_many_parameters(self):\n source = {\"query\": {\"term\": {\"_id\": \"171171\"}}}\n source = self._set_count_query(source)\n parameters = {'df': '_id', 'test': True}\n response = yield self.es_connection.count(callback=self.stop, source=source, parameters=parameters)\n self.assertCount(response, 1)\n self.assertTrue('df=_id' in response.request.url)\n self.assertTrue('test=True' in response.request.url)", "metadata": "root.TestESConnectionWithTornadoGen.test_count_specific_query_with_many_parameters", "header": "['class', 'TestESConnectionWithTornadoGen', '(', 'ESConnectionTestBase', ')', ':', '___EOS___']", "index": 289 } ]
[ { "span": "self.assertFalse(\"hits\" in response['responses'][1])", "start_line": 92, "start_column": 8, "end_line": 92, "end_column": 60 }, { "span": "self.assertTrue('df=_id' in response.request.url)", "start_line": 176, "start_column": 8, "end_line": 176, "end_column": 57 }, { "span": "self.assertTrue('test=True' in response.request.url)", "start_line": 177, "start_column": 8, "end_line": 177, "end_column": 60 }, { "span": "self.assertFalse(\"hits\" in response['responses'][1])", "start_line": 228, "start_column": 8, "end_line": 228, "end_column": 60 }, { "span": "self.assertTrue('df=_id' in response.request.url)", "start_line": 296, "start_column": 8, "end_line": 296, "end_column": 57 }, { "span": "self.assertTrue('test=True' in response.request.url)", "start_line": 297, "start_column": 8, "end_line": 297, "end_column": 60 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "ESC", "onnect", "ion_", "(_", "ESC", "onnect", "ion", "Test", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "shou", "ld", "\\u", "make", "\\u", "two", "\\u", "searche", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "make", "\\u", "multis", "earch_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "\\u", "verify", "\\u", "status", "\\u", "code", "\\u", "and", "\\u", "return", "\\u", "response_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "[_", "'", "response", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "hits", "'_", "]_", "[_", "'", "hits", "'_", "]_", "[_", "0_", "]_", "[_", "'\\u", "id", "'_", "]_", ",_", "\"", "171", "171", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "\"", "hits", "\"_", "in_", "response_", "[_", "'", "response", "s", "'_", "]_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "ESC", "onnect", "ion_", "(_", "ESC", "onnect", "ion", "Test", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "count", "\\u", "specific", "\\u", "query", "\\u", "with", "\\u", "many", "\\u", "parameters_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "source_", "=_", "{_", "\"", "query", "\"_", ":_", "{_", "\"", "term", "\"_", ":_", "{_", "\"\\u", "id", "\"_", ":_", "\"", "171", "171", "\"_", "}_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source_", "=_", "self_", "._", "\\u", "set\\u", "count", "\\u", "query_", "(_", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parameters_", "=_", "{_", "'", "df", "'_", ":_", "'\\u", "id", "'_", ",_", "'", "test", "'_", ":_", "True_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "es", "\\u", "connection_", "._", "count_", "(_", "callback_", "=_", "self_", "._", "stop_", ",_", "source_", "=_", "source_", ",_", "parameters_", "=_", "parameters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "wait_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response", "\\u", "dict_", "=_", "self_", "._", "\\u", "verify", "\\u", "response", "\\u", "and", "\\u", "return", "s", "\\u", "dict_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response", "\\u", "dict_", "[_", "\"", "count", "\"_", "]_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "df", "=", "\\u", "id", "'_", "in_", "response_", "._", "request_", "._", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "test", "=", "Tru", "e", "'_", "in_", "response_", "._", "request_", "._", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "ESC", "onnect", "ion", "With", "Tor", "nad", "o", "Gen_", "(_", "ESC", "onnect", "ion", "Test", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "gen", "\\u", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "shou", "ld", "\\u", "make", "\\u", "two", "\\u", "searche", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "make", "\\u", "multis", "earch_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "yield_", "self_", "._", "es", "\\u", "connection_", "._", "appl", "y", "\\u", "search_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "\\u", "verify", "\\u", "status", "\\u", "code", "\\u", "and", "\\u", "return", "\\u", "response_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "[_", "'", "response", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "hits", "'_", "]_", "[_", "'", "hits", "'_", "]_", "[_", "0_", "]_", "[_", "'\\u", "id", "'_", "]_", ",_", "\"", "171", "171", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "\"", "hits", "\"_", "in_", "response_", "[_", "'", "response", "s", "'_", "]_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "ESC", "onnect", "ion", "With", "Tor", "nad", "o", "Gen_", "(_", "ESC", "onnect", "ion", "Test", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "gen", "\\u", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "count", "\\u", "specific", "\\u", "query", "\\u", "with", "\\u", "many", "\\u", "parameters_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "source_", "=_", "{_", "\"", "query", "\"_", ":_", "{_", "\"", "term", "\"_", ":_", "{_", "\"\\u", "id", "\"_", ":_", "\"", "171", "171", "\"_", "}_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source_", "=_", "self_", "._", "\\u", "set\\u", "count", "\\u", "query_", "(_", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parameters_", "=_", "{_", "'", "df", "'_", ":_", "'\\u", "id", "'_", ",_", "'", "test", "'_", ":_", "True_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "yield_", "self_", "._", "es", "\\u", "connection_", "._", "count_", "(_", "callback_", "=_", "self_", "._", "stop_", ",_", "source_", "=_", "source_", ",_", "parameters_", "=_", "parameters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Count_", "(_", "response_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "df", "=", "\\u", "id", "'_", "in_", "response_", "._", "request_", "._", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "test", "=", "Tru", "e", "'_", "in_", "response_", "._", "request_", "._", "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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Unused import
enthought/traitsui/integrationtests/ui/check_list_editor_test2.py
[ { "content": "#-------------------------------------------------------------------------------\n#\n# CheckListEditor test case for Traits UI\n#\n# Written by: David C. Morrill\n#\n# Date: 06/29/2005\n#\n# (c) Copyright 2005 by Enthought, Inc.\n# License: BSD Style.\n#\n#-------------------------------------------------------------------------------\n\n#-------------------------------------------------------------------------------\n# Imports:\n#-------------------------------------------------------------------------------\n\nfrom traits.api \\\n import Enum, List, Str\n\nfrom traitsui.api \\\n import Handler, View, Item, CheckListEditor\n\n#-------------------------------------------------------------------------------\n# 'CheckListTest' class:\n#-------------------------------------------------------------------------------\n\n\n#-------------------------------------------------------------------------------\n# Run the tests:\n#-------------------------------------------------------------------------------\n\nif __name__ == '__main__':\n clt = CheckListTest()\n clt.configure_traits( view = 'simple_view' )\n print 'value:', clt.value\n clt.configure_traits( view = 'custom_view' )\n print 'value:', clt.value\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class CheckListTest ( Handler ):\n\n #---------------------------------------------------------------------------\n # Trait definitions:\n #---------------------------------------------------------------------------\n\n value = List( editor = CheckListEditor( name = 'values', cols = 5 ) )\n values = List( Str )\n values_text = Str( 'red orange yellow green blue indigo violet' )\n\n #---------------------------------------------------------------------------\n # Traits view definitions:\n #---------------------------------------------------------------------------\n\n simple_view = View( 'value', 'values_text@' )\n custom_view = View( 'value@', 'values_text@' )\n\n #---------------------------------------------------------------------------\n # 'Initializes the object:\n #---------------------------------------------------------------------------\n\n\n #---------------------------------------------------------------------------\n # Event handlers:\n #---------------------------------------------------------------------------\n", "metadata": "root.CheckListTest", "header": "['module', '___EOS___']", "index": 27 }, { "content": " def __init__ ( self, **traits ):\n super( CheckListTest, self ).__init__( **traits )\n self._values_text_changed()", "metadata": "root.CheckListTest.__init__", "header": "['class', 'CheckListTest', '(', 'Handler', ')', ':', '___NEWLINE___', '___NL___', '#---------------------------------------------------------------------------', '___NL___', '# Trait definitions:', '___NL___', '#---------------------------------------------------------------------------', '___NL___', '___EOS___']", "index": 48 }, { "content": " def _values_text_changed ( self ):\n self.values = self.values_text.split()", "metadata": "root.CheckListTest._values_text_changed", "header": "['class', 'CheckListTest', '(', 'Handler', ')', ':', '___NEWLINE___', '___NL___', '#---------------------------------------------------------------------------', '___NL___', '# Trait definitions:', '___NL___', '#---------------------------------------------------------------------------', '___NL___', '___EOS___']", "index": 56 } ]
[ { "span": "from traits.api \\\n import Enum, List, Str", "start_line": 17, "start_column": 0, "end_line": 18, "end_column": 26 }, { "span": "from traitsui.api \\\n import Handler, View, Item, CheckListEditor", "start_line": 20, "start_column": 0, "end_line": 21, "end_column": 47 } ]
[]
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_", "#", " ", " ", "Check", "List", "Edit", "or", " ", "test", " ", "case", " ", "for", " ", "Trait", "s", " ", "UI_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Writ", "ten", " ", "by", ":", " ", "Dav", "id", " ", "C", ".", " ", "Mor", "rill", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Date", ":", " ", "0", "6", "/", "2", "9", "/", "2005", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "(", "c", ")", " ", "Copy", "right", " ", "2005", " ", "by", " ", "Ent", "hou", "ght", ",", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "License", ":", " ", "BS", "D", " ", "Style", "._", "\\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_", "#", " ", " ", "Imports", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "traits_", "._", "api_", "import_", "Enum_", ",_", "List_", ",_", "Str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "traits", "ui_", "._", "api_", "import_", "Handler_", ",_", "View_", ",_", "Item_", ",_", "Check", "List", "Editor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "'", "Check", "List", "Test", "'", " ", "class", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Run", " ", "the", " ", "tests", ":_", "\\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\\uINDENT\\u\\u\\u ", " _", "clt", "_", "=_", "Check", "List", "Test_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clt", "_", "._", "configur", "e\\u", "traits_", "(_", "view_", "=_", "'", "simple", "\\u", "view", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "value", ":'_", ",_", "clt", "_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clt", "_", "._", "configur", "e\\u", "traits_", "(_", "view_", "=_", "'", "custom", "\\u", "view", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "value", ":'_", ",_", "clt", "_", "._", "value_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Check", "List", "Test_", "(_", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "----", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Trait", " ", "definit", "ion", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "----", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "List_", "(_", "editor_", "=_", "Check", "List", "Editor_", "(_", "name_", "=_", "'", "values", "'_", ",_", "cols_", "=_", "5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "values_", "=_", "List_", "(_", "Str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "values", "\\u", "text_", "=_", "Str_", "(_", "'", "red", " ", "orange", " ", "yell", "ow", " ", "green", " ", "blue", " ", "indig", "o", " ", "violet", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "----", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Trait", "s", " ", "view", " ", "definit", "ion", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "----", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "simple", "\\u", "view_", "=_", "View_", "(_", "'", "value", "'_", ",_", "'", "values", "\\u", "text", "@'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "custom", "\\u", "view_", "=_", "View_", "(_", "'", "value", "@'_", ",_", "'", "values", "\\u", "text", "@'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "----", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "'", "Initializ", "es", " ", "the", " ", "object", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "----", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "----", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Event", " ", "handler", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "----", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Check", "List", "Test_", "(_", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "----", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Trait", " ", "definit", "ion", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "----", "_", "\\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_", ",_", "**_", "traits_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Check", "List", "Test_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "**_", "traits_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "values", "\\u", "text", "\\u", "changed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Check", "List", "Test_", "(_", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "----", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Trait", " ", "definit", "ion", "s", ":_", "\\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_", "\\u", "values", "\\u", "text", "\\u", "changed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "values_", "=_", "self_", "._", "values", "\\u", "text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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 ]
Unused local variable
chrippa/livestreamer/src/livestreamer/packages/flashmedia/amf.py
[ { "content": " @classmethod\n def _deserialize(cls, io):\n name = AMF0String.read(io)\n must_understand = bool(U8.read(io))\n length = U32BE.read(io)\n value = AMF0Value.read(io)\n\n return cls(name, value, must_understand)", "metadata": "root.AMFHeader._deserialize", "header": "['class', 'AMFHeader', '(', 'Packet', ')', ':', '___EOS___']", "index": 27 }, { "content": " @classmethod\n def _deserialize(cls, io):\n target_uri = AMF0String.read(io)\n response_uri = AMF0String.read(io)\n length = U32BE.read(io)\n value = AMF0Value.read(io)\n\n return cls(target_uri, response_uri, value)", "metadata": "root.AMFMessage._deserialize", "header": "['class', 'AMFMessage', '(', 'Packet', ')', ':', '___EOS___']", "index": 60 } ]
[ { "span": "length ", "start_line": 31, "start_column": 8, "end_line": 31, "end_column": 14 }, { "span": "length ", "start_line": 64, "start_column": 8, "end_line": 64, "end_column": 14 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "AM", "FH", "eader", "_", "(_", "Packet_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "deserialize_", "(_", "cls_", ",_", "io_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "AM", "F0", "String_", "._", "read_", "(_", "io_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "must", "\\u", "underst", "and_", "=_", "bool_", "(_", "U", "8_", "._", "read_", "(_", "io_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "length_", "=_", "U3", "2", "BE_", "._", "read_", "(_", "io_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "AM", "F0", "Value_", "._", "read_", "(_", "io_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "cls_", "(_", "name_", ",_", "value_", ",_", "must", "\\u", "underst", "and_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "AM", "FM", "essage_", "(_", "Packet_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "deserialize_", "(_", "cls_", ",_", "io_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target", "\\u", "uri_", "=_", "AM", "F0", "String_", "._", "read_", "(_", "io_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response", "\\u", "uri_", "=_", "AM", "F0", "String_", "._", "read_", "(_", "io_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "length_", "=_", "U3", "2", "BE_", "._", "read_", "(_", "io_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "AM", "F0", "Value_", "._", "read_", "(_", "io_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "cls_", "(_", "target", "\\u", "uri_", ",_", "response", "\\u", "uri_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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 ]
Unused import
EasyEngine/easyengine/ee/cli/plugins/site.py
[ { "content": "# \"\"\"EasyEngine site controller.\"\"\"\nfrom cement.core.controller import CementBaseController, expose\nfrom cement.core import handler, hook\nfrom ee.core.cron import EECron\nfrom ee.core.sslutils import SSL\nfrom ee.core.variables import EEVariables\nfrom ee.core.domainvalidate import ValidateDomain\nfrom ee.core.fileutils import EEFileUtils\nfrom ee.cli.plugins.site_functions import *\nfrom ee.core.services import EEService\nfrom ee.cli.plugins.sitedb import *\nfrom ee.core.git import EEGit\nfrom subprocess import Popen\nfrom ee.core.nginxhashbucket import hashbucket\nimport sys\nimport os\nimport glob\nimport subprocess\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def ee_site_hook(app):\n # do something with the ``app`` object here.\n from ee.core.database import init_db\n import ee.cli.plugins.models\n init_db(app)", "metadata": "root.ee_site_hook", "header": "['module', '___EOS___']", "index": 20 }, { "content": "class EESiteController(CementBaseController):\n class Meta:\n label = 'site'\n stacked_on = 'base'\n stacked_type = 'nested'\n description = ('Performs website specific operations')\n arguments = [\n (['site_name'],\n dict(help='Website name', nargs='?')),\n ]\n usage = \"ee site (command) <site_name> [options]\"\n\n\n\n\n\n\n", "metadata": "root.EESiteController", "header": "['module', '___EOS___']", "index": 27 }, { "content": " @expose(hide=True)\n def default(self):\n self.app.args.print_help()", "metadata": "root.EESiteController.default", "header": "['class', 'EESiteController', '(', 'CementBaseController', ')', ':', '___EOS___']", "index": 39 }, { "content": " @expose(help=\"Enable site example.com\")\n def enable(self):\n if not self.app.pargs.site_name:\n try:\n while not self.app.pargs.site_name:\n self.app.pargs.site_name = (input('Enter site name : ')\n .strip())\n except IOError as e:\n Log.error(self, 'could not input site name')\n\n self.app.pargs.site_name = self.app.pargs.site_name.strip()\n # validate domain name\n (ee_domain, ee_www_domain) = ValidateDomain(self.app.pargs.site_name)\n\n # check if site exists\n if not check_domain_exists(self, ee_domain):\n Log.error(self, \"site {0} does not exist\".format(ee_domain))\n if os.path.isfile('/etc/nginx/sites-available/{0}'\n .format(ee_domain)):\n Log.info(self, \"Enable domain {0:10} \\t\".format(ee_domain), end='')\n EEFileUtils.create_symlink(self,\n ['/etc/nginx/sites-available/{0}'\n .format(ee_domain),\n '/etc/nginx/sites-enabled/{0}'\n .format(ee_domain)])\n EEGit.add(self, [\"/etc/nginx\"],\n msg=\"Enabled {0} \"\n .format(ee_domain))\n updateSiteInfo(self, ee_domain, enabled=True)\n Log.info(self, \"[\" + Log.ENDC + \"OK\" + Log.OKBLUE + \"]\")\n if not EEService.reload_service(self, 'nginx'):\n Log.error(self, \"service nginx reload failed. \"\n \"check issues with `nginx -t` command\")\n else:\n Log.error(self, \"nginx configuration file does not exist\"\n .format(ee_domain))", "metadata": "root.EESiteController.enable", "header": "['class', 'EESiteController', '(', 'CementBaseController', ')', ':', '___EOS___']", "index": 43 }, { "content": " @expose(help=\"Disable site example.com\")\n def disable(self):\n if not self.app.pargs.site_name:\n try:\n while not self.app.pargs.site_name:\n self.app.pargs.site_name = (input('Enter site name : ')\n .strip())\n\n except IOError as e:\n Log.error(self, 'could not input site name')\n self.app.pargs.site_name = self.app.pargs.site_name.strip()\n (ee_domain, ee_www_domain) = ValidateDomain(self.app.pargs.site_name)\n # check if site exists\n if not check_domain_exists(self, ee_domain):\n Log.error(self, \"site {0} does not exist\".format(ee_domain))\n\n if os.path.isfile('/etc/nginx/sites-available/{0}'\n .format(ee_domain)):\n Log.info(self, \"Disable domain {0:10} \\t\"\n .format(ee_domain), end='')\n if not os.path.isfile('/etc/nginx/sites-enabled/{0}'\n .format(ee_domain)):\n Log.debug(self, \"Site {0} already disabled\".format(ee_domain))\n Log.info(self, \"[\" + Log.FAIL + \"Failed\" + Log.OKBLUE+\"]\")\n else:\n EEFileUtils.remove_symlink(self,\n '/etc/nginx/sites-enabled/{0}'\n .format(ee_domain))\n EEGit.add(self, [\"/etc/nginx\"],\n msg=\"Disabled {0} \"\n .format(ee_domain))\n updateSiteInfo(self, ee_domain, enabled=False)\n Log.info(self, \"[\" + Log.ENDC + \"OK\" + Log.OKBLUE + \"]\")\n if not EEService.reload_service(self, 'nginx'):\n Log.error(self, \"service nginx reload failed. \"\n \"check issues with `nginx -t` command\")\n else:\n Log.error(self, \"nginx configuration file does not exist\"\n .format(ee_domain))", "metadata": "root.EESiteController.disable", "header": "['class', 'EESiteController', '(', 'CementBaseController', ')', ':', '___EOS___']", "index": 80 }, { "content": " @expose(help=\"Get example.com information\")\n def info(self):\n if not self.app.pargs.site_name:\n try:\n while not self.app.pargs.site_name:\n self.app.pargs.site_name = (input('Enter site name : ')\n .strip())\n except IOError as e:\n Log.error(self, 'could not input site name')\n self.app.pargs.site_name = self.app.pargs.site_name.strip()\n (ee_domain, ee_www_domain) = ValidateDomain(self.app.pargs.site_name)\n ee_db_name = ''\n ee_db_user = ''\n ee_db_pass = ''\n hhvm = ''\n\n if not check_domain_exists(self, ee_domain):\n Log.error(self, \"site {0} does not exist\".format(ee_domain))\n if os.path.isfile('/etc/nginx/sites-available/{0}'\n .format(ee_domain)):\n siteinfo = getSiteInfo(self, ee_domain)\n\n sitetype = siteinfo.site_type\n cachetype = siteinfo.cache_type\n ee_site_webroot = siteinfo.site_path\n access_log = (ee_site_webroot + '/logs/access.log')\n error_log = (ee_site_webroot + '/logs/error.log')\n ee_db_name = siteinfo.db_name\n ee_db_user = siteinfo.db_user\n ee_db_pass = siteinfo.db_password\n ee_db_host = siteinfo.db_host\n if sitetype != \"html\":\n hhvm = (\"enabled\" if siteinfo.is_hhvm else \"disabled\")\n if sitetype == \"proxy\":\n access_log = \"/var/log/nginx/{0}.access.log\".format(ee_domain)\n error_log = \"/var/log/nginx/{0}.error.log\".format(ee_domain)\n ee_site_webroot = ''\n\n php_version = siteinfo.php_version\n pagespeed = (\"enabled\" if siteinfo.is_pagespeed else \"disabled\")\n ssl = (\"enabled\" if siteinfo.is_ssl else \"disabled\")\n if (ssl == \"enabled\"):\n sslprovider = \"Lets Encrypt\"\n sslexpiry = str(SSL.getExpirationDate(self,ee_domain))\n else:\n sslprovider = ''\n sslexpiry = ''\n data = dict(domain=ee_domain, webroot=ee_site_webroot,\n accesslog=access_log, errorlog=error_log,\n dbname=ee_db_name, dbuser=ee_db_user,php_version=php_version,\n dbpass=ee_db_pass, hhvm=hhvm, pagespeed=pagespeed,\n ssl=ssl, sslprovider=sslprovider, sslexpiry= sslexpiry,\n type=sitetype + \" \" + cachetype + \" ({0})\"\n .format(\"enabled\" if siteinfo.is_enabled else\n \"disabled\"))\n self.app.render((data), 'siteinfo.mustache')\n else:\n Log.error(self, \"nginx configuration file does not exist\"\n .format(ee_domain))", "metadata": "root.EESiteController.info", "header": "['class', 'EESiteController', '(', 'CementBaseController', ')', ':', '___EOS___']", "index": 120 }, { "content": " @expose(help=\"Monitor example.com logs\")\n def log(self):\n self.app.pargs.site_name = self.app.pargs.site_name.strip()\n (ee_domain, ee_www_domain) = ValidateDomain(self.app.pargs.site_name)\n ee_site_webroot = getSiteInfo(self, ee_domain).site_path\n\n if not check_domain_exists(self, ee_domain):\n Log.error(self, \"site {0} does not exist\".format(ee_domain))\n logfiles = glob.glob(ee_site_webroot + '/logs/*.log')\n if logfiles:\n logwatch(self, logfiles)", "metadata": "root.EESiteController.log", "header": "['class', 'EESiteController', '(', 'CementBaseController', ')', ':', '___EOS___']", "index": 180 }, { "content": " @expose(help=\"Display Nginx configuration of example.com\")\n def show(self):\n if not self.app.pargs.site_name:\n try:\n while not self.app.pargs.site_name:\n self.app.pargs.site_name = (input('Enter site name : ')\n .strip())\n except IOError as e:\n Log.error(self, 'could not input site name')\n # TODO Write code for ee site edit command here\n self.app.pargs.site_name = self.app.pargs.site_name.strip()\n (ee_domain, ee_www_domain) = ValidateDomain(self.app.pargs.site_name)\n\n if not check_domain_exists(self, ee_domain):\n Log.error(self, \"site {0} does not exist\".format(ee_domain))\n\n if os.path.isfile('/etc/nginx/sites-available/{0}'\n .format(ee_domain)):\n Log.info(self, \"Display NGINX configuration for {0}\"\n .format(ee_domain))\n f = open('/etc/nginx/sites-available/{0}'.format(ee_domain),\n encoding='utf-8', mode='r')\n text = f.read()\n Log.info(self, Log.ENDC + text)\n f.close()\n else:\n Log.error(self, \"nginx configuration file does not exists\"\n .format(ee_domain))", "metadata": "root.EESiteController.show", "header": "['class', 'EESiteController', '(', 'CementBaseController', ')', ':', '___EOS___']", "index": 192 }, { "content": " @expose(help=\"Change directory to site webroot\")\n def cd(self):\n if not self.app.pargs.site_name:\n try:\n while not self.app.pargs.site_name:\n self.app.pargs.site_name = (input('Enter site name : ')\n .strip())\n except IOError as e:\n Log.error(self, 'Unable to read input, please try again')\n\n self.app.pargs.site_name = self.app.pargs.site_name.strip()\n (ee_domain, ee_www_domain) = ValidateDomain(self.app.pargs.site_name)\n\n if not check_domain_exists(self, ee_domain):\n Log.error(self, \"site {0} does not exist\".format(ee_domain))\n\n ee_site_webroot = getSiteInfo(self, ee_domain).site_path\n EEFileUtils.chdir(self, ee_site_webroot)\n\n try:\n subprocess.call(['bash'])\n except OSError as e:\n Log.debug(self, \"{0}{1}\".format(e.errno, e.strerror))\n Log.error(self, \"unable to change directory\")", "metadata": "root.EESiteController.cd", "header": "['class', 'EESiteController', '(', 'CementBaseController', ')', ':', '___EOS___']", "index": 221 }, { "content": "class EESiteEditController(CementBaseController):\n class Meta:\n label = 'edit'\n stacked_on = 'site'\n stacked_type = 'nested'\n description = ('Edit Nginx configuration of site')\n arguments = [\n (['site_name'],\n dict(help='domain name for the site',\n nargs='?')),\n (['--pagespeed'],\n dict(help=\"edit pagespeed configuration for site\",\n action='store_true')),\n ]\n", "metadata": "root.EESiteEditController", "header": "['module', '___EOS___']", "index": 247 }, { "content": " @expose(hide=True)\n def default(self):\n if not self.app.pargs.site_name:\n try:\n while not self.app.pargs.site_name:\n self.app.pargs.site_name = (input('Enter site name : ')\n .strip())\n except IOError as e:\n Log.error(self, 'Unable to read input, Please try again')\n\n self.app.pargs.site_name = self.app.pargs.site_name.strip()\n (ee_domain, ee_www_domain) = ValidateDomain(self.app.pargs.site_name)\n\n if not check_domain_exists(self, ee_domain):\n Log.error(self, \"site {0} does not exist\".format(ee_domain))\n\n ee_site_webroot = EEVariables.ee_webroot + ee_domain\n\n if not self.app.pargs.pagespeed:\n if os.path.isfile('/etc/nginx/sites-available/{0}'\n .format(ee_domain)):\n try:\n EEShellExec.invoke_editor(self, '/etc/nginx/sites-availa'\n 'ble/{0}'.format(ee_domain))\n except CommandExecutionError as e:\n Log.error(self, \"Failed invoke editor\")\n if (EEGit.checkfilestatus(self, \"/etc/nginx\",\n '/etc/nginx/sites-available/{0}'.format(ee_domain))):\n EEGit.add(self, [\"/etc/nginx\"], msg=\"Edit website: {0}\"\n .format(ee_domain))\n # Reload NGINX\n if not EEService.reload_service(self, 'nginx'):\n Log.error(self, \"service nginx reload failed. \"\n \"check issues with `nginx -t` command\")\n else:\n Log.error(self, \"nginx configuration file does not exists\"\n .format(ee_domain))\n\n elif self.app.pargs.pagespeed:\n if os.path.isfile('{0}/conf/nginx/pagespeed.conf'\n .format(ee_site_webroot)):\n try:\n EEShellExec.invoke_editor(self, '{0}/conf/nginx/'\n 'pagespeed.conf'\n .format(ee_site_webroot))\n except CommandExecutionError as e:\n Log.error(self, \"Failed invoke editor\")\n if (EEGit.checkfilestatus(self, \"{0}/conf/nginx\"\n .format(ee_site_webroot),\n '{0}/conf/nginx/pagespeed.conf'.format(ee_site_webroot))):\n EEGit.add(self, [\"{0}/conf/nginx\".format(ee_site_webroot)],\n msg=\"Edit Pagespped config of site: {0}\"\n .format(ee_domain))\n # Reload NGINX\n if not EEService.reload_service(self, 'nginx'):\n Log.error(self, \"service nginx reload failed. \"\n \"check issues with `nginx -t` command\")\n else:\n Log.error(self, \"Pagespeed configuration file does not exists\"\n .format(ee_domain))", "metadata": "root.EESiteEditController.default", "header": "['class', 'EESiteEditController', '(', 'CementBaseController', ')', ':', '___EOS___']", "index": 262 }, { "content": "class EESiteCreateController(CementBaseController):\n class Meta:\n label = 'create'\n stacked_on = 'site'\n stacked_type = 'nested'\n description = ('this commands set up configuration and installs '\n 'required files as options are provided')\n arguments = [\n (['site_name'],\n dict(help='domain name for the site to be created.',\n nargs='?')),\n (['--html'],\n dict(help=\"create html site\", action='store_true')),\n (['--php'],\n dict(help=\"create php site\", action='store_true')),\n (['--php7'],\n dict(help=\"create php 7.0 site\", action='store_true')),\n (['--mysql'],\n dict(help=\"create mysql site\", action='store_true')),\n (['--wp'],\n dict(help=\"create wordpress single site\",\n action='store_true')),\n (['--wpsubdir'],\n dict(help=\"create wordpress multisite with subdirectory setup\",\n action='store_true')),\n (['--wpsubdomain'],\n dict(help=\"create wordpress multisite with subdomain setup\",\n action='store_true')),\n (['--w3tc'],\n dict(help=\"create wordpress single/multi site with w3tc cache\",\n action='store_true')),\n (['--wpfc'],\n dict(help=\"create wordpress single/multi site with wpfc cache\",\n action='store_true')),\n (['--wpsc'],\n dict(help=\"create wordpress single/multi site with wpsc cache\",\n action='store_true')),\n (['--wpredis'],\n dict(help=\"create wordpress single/multi site with redis cache\",\n action='store_true')),\n (['--hhvm'],\n dict(help=\"create HHVM site\", action='store_true')),\n (['--pagespeed'],\n dict(help=\"create pagespeed site\", action='store_true')),\n (['-le','--letsencrypt'],\n dict(help=\"configure letsencrypt ssl for the site\", action='store_true')),\n (['--user'],\n dict(help=\"provide user for wordpress site\")),\n (['--email'],\n dict(help=\"provide email address for wordpress site\")),\n (['--pass'],\n dict(help=\"provide password for wordpress user\",\n dest='wppass')),\n (['--proxy'],\n dict(help=\"create proxy for site\", nargs='+')),\n (['--experimental'],\n dict(help=\"Enable Experimenal packages without prompt\",\n action='store_true')),\n ]\n", "metadata": "root.EESiteCreateController", "header": "['module', '___EOS___']", "index": 324 }, { "content": " @expose(hide=True)\n def default(self):\n # self.app.render((data), 'default.mustache')\n # Check domain name validation\n data = dict()\n host, port = None, None\n try:\n stype, cache = detSitePar(vars(self.app.pargs))\n except RuntimeError as e:\n Log.debug(self, str(e))\n Log.error(self, \"Please provide valid options to creating site\")\n\n if stype is None and self.app.pargs.proxy:\n stype, cache = 'proxy', ''\n proxyinfo = self.app.pargs.proxy[0].strip()\n if not proxyinfo:\n Log.error(self, \"Please provide proxy server host information\")\n proxyinfo = proxyinfo.split(':')\n host = proxyinfo[0].strip()\n port = '80' if len(proxyinfo) < 2 else proxyinfo[1].strip()\n elif stype is None and not self.app.pargs.proxy:\n stype, cache = 'html', 'basic'\n elif stype and self.app.pargs.proxy:\n Log.error(self, \"proxy should not be used with other site types\")\n if (self.app.pargs.proxy and (self.app.pargs.pagespeed\n or self.app.pargs.hhvm)):\n Log.error(self, \"Proxy site can not run on pagespeed or hhvm\")\n\n if not self.app.pargs.site_name:\n try:\n while not self.app.pargs.site_name:\n # preprocessing before finalize site name\n self.app.pargs.site_name = (input('Enter site name : ')\n .strip())\n except IOError as e:\n Log.debug(self, str(e))\n Log.error(self, \"Unable to input site name, Please try again!\")\n\n self.app.pargs.site_name = self.app.pargs.site_name.strip()\n (ee_domain, ee_www_domain) = ValidateDomain(self.app.pargs.site_name)\n\n if not ee_domain.strip():\n Log.error(\"Invalid domain name, \"\n \"Provide valid domain name\")\n\n ee_site_webroot = EEVariables.ee_webroot + ee_domain\n\n if check_domain_exists(self, ee_domain):\n Log.error(self, \"site {0} already exists\".format(ee_domain))\n elif os.path.isfile('/etc/nginx/sites-available/{0}'\n .format(ee_domain)):\n Log.error(self, \"Nginx configuration /etc/nginx/sites-available/\"\n \"{0} already exists\".format(ee_domain))\n\n if stype == 'proxy':\n data['site_name'] = ee_domain\n data['www_domain'] = ee_www_domain\n data['proxy'] = True\n data['host'] = host\n data['port'] = port\n ee_site_webroot = \"\"\n\n if self.app.pargs.php7:\n data = dict(site_name=ee_domain, www_domain=ee_www_domain,\n static=False, basic=False, php7=True, wp=False, w3tc=False,\n wpfc=False, wpsc=False, multisite=False,\n wpsubdir=False, webroot=ee_site_webroot)\n data['basic'] = True\n\n if stype in ['html', 'php' ]:\n data = dict(site_name=ee_domain, www_domain=ee_www_domain,\n static=True, basic=False, php7=False, wp=False, w3tc=False,\n wpfc=False, wpsc=False, multisite=False,\n wpsubdir=False, webroot=ee_site_webroot)\n\n if stype == 'php':\n data['static'] = False\n data['basic'] = True\n\n elif stype in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']:\n\n data = dict(site_name=ee_domain, www_domain=ee_www_domain,\n static=False, basic=True, wp=False, w3tc=False,\n wpfc=False, wpsc=False, wpredis=False, multisite=False,\n wpsubdir=False, webroot=ee_site_webroot,\n ee_db_name='', ee_db_user='', ee_db_pass='',\n ee_db_host='')\n\n if stype in ['wp', 'wpsubdir', 'wpsubdomain']:\n data['wp'] = True\n data['basic'] = False\n data[cache] = True\n data['wp-user'] = self.app.pargs.user\n data['wp-email'] = self.app.pargs.email\n data['wp-pass'] = self.app.pargs.wppass\n if stype in ['wpsubdir', 'wpsubdomain']:\n data['multisite'] = True\n if stype == 'wpsubdir':\n data['wpsubdir'] = True\n else:\n pass\n\n if stype == \"html\" and self.app.pargs.hhvm:\n Log.error(self, \"Can not create HTML site with HHVM\")\n\n if data and self.app.pargs.php7:\n if (not self.app.pargs.experimental):\n Log.info(self, \"PHP7.0 is experimental feature and it may not \"\n \"work with all CSS/JS/Cache of your site.\\nDo you wish\"\n \" to install PHP 7.0 now for {0}?\".format(ee_domain))\n\n # Check prompt\n check_prompt = input(\"Type \\\"y\\\" to continue [n]:\")\n if check_prompt != \"Y\" and check_prompt != \"y\":\n Log.info(self, \"Not using PHP 7.0 for site.\")\n data['php7'] = False\n data['basic'] = True\n php7 = 0\n self.app.pargs.php7 = False\n else:\n data['php7'] = True\n php7 = 1\n else:\n data['php7'] = True\n php7 = 1\n elif data:\n data['php7'] = False\n php7 = 0\n\n if (not self.app.pargs.w3tc) and\\\n (not self.app.pargs.wpfc) and (not self.app.pargs.wpsc) and (not self.app.pargs.wpredis) \\\n and (not self.app.pargs.hhvm):\n data['basic'] = True\n\n #for debug purpose\n #for key, value in data.items() :\n # print (key, value)\n\n\n if data and self.app.pargs.hhvm:\n if (not self.app.pargs.experimental):\n Log.info(self, \"HHVM is experimental feature and it may not \"\n \"work with all plugins of your site.\\nYou can \"\n \"disable it by passing --hhvm=off later.\\nDo you wish\"\n \" to enable HHVM now for {0}?\".format(ee_domain))\n\n # Check prompt\n check_prompt = input(\"Type \\\"y\\\" to continue [n]:\")\n if check_prompt != \"Y\" and check_prompt != \"y\":\n Log.info(self, \"Not using HHVM for site.\")\n data['hhvm'] = False\n hhvm = 0\n self.app.pargs.hhvm = False\n else:\n data['hhvm'] = True\n hhvm = 1\n else:\n data['hhvm'] = True\n hhvm = 1\n\n elif data:\n data['hhvm'] = False\n hhvm = 0\n\n if data and self.app.pargs.pagespeed:\n if (not self.app.pargs.experimental):\n Log.info(self, \"PageSpeed is experimental feature and it may not \"\n \"work with all CSS/JS/Cache of your site.\\nYou can \"\n \"disable it by passing --pagespeed=off later.\\nDo you wish\"\n \" to enable PageSpeed now for {0}?\".format(ee_domain))\n\n # Check prompt\n check_prompt = input(\"Type \\\"y\\\" to continue [n]:\")\n if check_prompt != \"Y\" and check_prompt != \"y\":\n Log.info(self, \"Not using PageSpeed for site.\")\n data['pagespeed'] = False\n pagespeed = 0\n self.app.pargs.pagespeed = False\n else:\n data['pagespeed'] = True\n pagespeed = 1\n else:\n data['pagespeed'] = True\n pagespeed = 1\n elif data:\n data['pagespeed'] = False\n pagespeed = 0\n\n if (cache == 'wpredis' and (not self.app.pargs.experimental)):\n Log.info(self, \"Redis is experimental feature and it may not \"\n \"work with all CSS/JS/Cache of your site.\\nYou can \"\n \"disable it by changing cache later.\\nDo you wish\"\n \" to enable Redis now for {0}?\".format(ee_domain))\n\n # Check prompt\n check_prompt = input(\"Type \\\"y\\\" to continue [n]:\")\n if check_prompt != \"Y\" and check_prompt != \"y\":\n Log.error(self, \"Not using Redis for site\")\n cache = 'basic'\n data['wpredis'] = False\n data['basic'] = True\n self.app.pargs.wpredis = False\n\n # self.app.args.print_help()\n # if not data:\n # self.app.close(1)\n\n # Check rerequired packages are installed or not\n ee_auth = site_package_check(self, stype)\n\n try:\n pre_run_checks(self)\n except SiteError as e:\n Log.debug(self, str(e))\n Log.error(self, \"NGINX configuration check failed.\")\n\n try:\n try:\n # setup NGINX configuration, and webroot\n setupdomain(self, data)\n\n # Fix Nginx Hashbucket size error\n hashbucket(self)\n except SiteError as e:\n # call cleanup actions on failure\n Log.info(self, Log.FAIL + \"Oops Something went wrong !!\")\n Log.info(self, Log.FAIL + \"Calling cleanup actions ...\")\n doCleanupAction(self, domain=ee_domain,\n webroot=data['webroot'])\n Log.debug(self, str(e))\n Log.error(self, \"Check logs for reason \"\n \"`tail /var/log/ee/ee.log` & Try Again!!!\")\n\n if 'proxy' in data.keys() and data['proxy']:\n addNewSite(self, ee_domain, stype, cache, ee_site_webroot)\n # Service Nginx Reload\n if not EEService.reload_service(self, 'nginx'):\n Log.info(self, Log.FAIL + \"Oops Something went wrong !!\")\n Log.info(self, Log.FAIL + \"Calling cleanup actions ...\")\n doCleanupAction(self, domain=ee_domain)\n deleteSiteInfo(self, ee_domain)\n Log.error(self, \"service nginx reload failed. \"\n \"check issues with `nginx -t` command\")\n Log.error(self, \"Check logs for reason \"\n \"`tail /var/log/ee/ee.log` & Try Again!!!\")\n if ee_auth and len(ee_auth):\n for msg in ee_auth:\n Log.info(self, Log.ENDC + msg, log=False)\n Log.info(self, \"Successfully created site\"\n \" http://{0}\".format(ee_domain))\n return\n # Update pagespeed config\n if self.app.pargs.pagespeed:\n operateOnPagespeed(self, data)\n\n if data['php7']:\n php_version = \"7.0\"\n else:\n php_version = \"5.6\"\n\n\n addNewSite(self, ee_domain, stype, cache, ee_site_webroot,\n hhvm=hhvm, pagespeed=pagespeed, php_version=php_version)\n\n # Setup database for MySQL site\n if 'ee_db_name' in data.keys() and not data['wp']:\n try:\n data = setupdatabase(self, data)\n # Add database information for site into database\n updateSiteInfo(self, ee_domain, db_name=data['ee_db_name'],\n db_user=data['ee_db_user'],\n db_password=data['ee_db_pass'],\n db_host=data['ee_db_host'])\n except SiteError as e:\n # call cleanup actions on failure\n Log.debug(self, str(e))\n Log.info(self, Log.FAIL + \"Oops Something went wrong !!\")\n Log.info(self, Log.FAIL + \"Calling cleanup actions ...\")\n doCleanupAction(self, domain=ee_domain,\n webroot=data['webroot'],\n dbname=data['ee_db_name'],\n dbuser=data['ee_db_user'],\n dbhost=data['ee_db_host'])\n deleteSiteInfo(self, ee_domain)\n Log.error(self, \"Check logs for reason \"\n \"`tail /var/log/ee/ee.log` & Try Again!!!\")\n\n try:\n eedbconfig = open(\"{0}/ee-config.php\"\n .format(ee_site_webroot),\n encoding='utf-8', mode='w')\n eedbconfig.write(\"<?php \\ndefine('DB_NAME', '{0}');\"\n \"\\ndefine('DB_USER', '{1}'); \"\n \"\\ndefine('DB_PASSWORD', '{2}');\"\n \"\\ndefine('DB_HOST', '{3}');\\n?>\"\n .format(data['ee_db_name'],\n data['ee_db_user'],\n data['ee_db_pass'],\n data['ee_db_host']))\n eedbconfig.close()\n stype = 'mysql'\n except IOError as e:\n Log.debug(self, str(e))\n Log.debug(self, \"Error occured while generating \"\n \"ee-config.php\")\n Log.info(self, Log.FAIL + \"Oops Something went wrong !!\")\n Log.info(self, Log.FAIL + \"Calling cleanup actions ...\")\n doCleanupAction(self, domain=ee_domain,\n webroot=data['webroot'],\n dbname=data['ee_db_name'],\n dbuser=data['ee_db_user'],\n dbhost=data['ee_db_host'])\n deleteSiteInfo(self, ee_domain)\n Log.error(self, \"Check logs for reason \"\n \"`tail /var/log/ee/ee.log` & Try Again!!!\")\n\n # Setup WordPress if Wordpress site\n if data['wp']:\n try:\n ee_wp_creds = setupwordpress(self, data)\n # Add database information for site into database\n updateSiteInfo(self, ee_domain, db_name=data['ee_db_name'],\n db_user=data['ee_db_user'],\n db_password=data['ee_db_pass'],\n db_host=data['ee_db_host'])\n except SiteError as e:\n # call cleanup actions on failure\n Log.debug(self, str(e))\n Log.info(self, Log.FAIL + \"Oops Something went wrong !!\")\n Log.info(self, Log.FAIL + \"Calling cleanup actions ...\")\n doCleanupAction(self, domain=ee_domain,\n webroot=data['webroot'],\n dbname=data['ee_db_name'],\n dbuser=data['ee_db_user'],\n dbhost=data['ee_mysql_grant_host'])\n deleteSiteInfo(self, ee_domain)\n Log.error(self, \"Check logs for reason \"\n \"`tail /var/log/ee/ee.log` & Try Again!!!\")\n\n # Service Nginx Reload call cleanup if failed to reload nginx\n if not EEService.reload_service(self, 'nginx'):\n Log.info(self, Log.FAIL + \"Oops Something went wrong !!\")\n Log.info(self, Log.FAIL + \"Calling cleanup actions ...\")\n doCleanupAction(self, domain=ee_domain,\n webroot=data['webroot'])\n if 'ee_db_name' in data.keys():\n doCleanupAction(self, domain=ee_domain,\n dbname=data['ee_db_name'],\n dbuser=data['ee_db_user'],\n dbhost=data['ee_mysql_grant_host'])\n deleteSiteInfo(self, ee_domain)\n Log.info(self, Log.FAIL + \"service nginx reload failed.\"\n \" check issues with `nginx -t` command.\")\n Log.error(self, \"Check logs for reason \"\n \"`tail /var/log/ee/ee.log` & Try Again!!!\")\n\n EEGit.add(self, [\"/etc/nginx\"],\n msg=\"{0} created with {1} {2}\"\n .format(ee_www_domain, stype, cache))\n # Setup Permissions for webroot\n try:\n setwebrootpermissions(self, data['webroot'])\n except SiteError as e:\n Log.debug(self, str(e))\n Log.info(self, Log.FAIL + \"Oops Something went wrong !!\")\n Log.info(self, Log.FAIL + \"Calling cleanup actions ...\")\n doCleanupAction(self, domain=ee_domain,\n webroot=data['webroot'])\n if 'ee_db_name' in data.keys():\n print(\"Inside db cleanup\")\n doCleanupAction(self, domain=ee_domain,\n dbname=data['ee_db_name'],\n dbuser=data['ee_db_user'],\n dbhost=data['ee_mysql_grant_host'])\n deleteSiteInfo(self, ee_domain)\n Log.error(self, \"Check logs for reason \"\n \"`tail /var/log/ee/ee.log` & Try Again!!!\")\n\n if ee_auth and len(ee_auth):\n for msg in ee_auth:\n Log.info(self, Log.ENDC + msg, log=False)\n\n if data['wp']:\n Log.info(self, Log.ENDC + \"WordPress admin user :\"\n \" {0}\".format(ee_wp_creds['wp_user']), log=False)\n Log.info(self, Log.ENDC + \"WordPress admin user password : {0}\"\n .format(ee_wp_creds['wp_pass']), log=False)\n\n display_cache_settings(self, data)\n\n Log.info(self, \"Successfully created site\"\n \" http://{0}\".format(ee_domain))\n except SiteError as e:\n Log.error(self, \"Check logs for reason \"\n \"`tail /var/log/ee/ee.log` & Try Again!!!\")\n\n if self.app.pargs.letsencrypt :\n if (not self.app.pargs.experimental):\n if stype in ['wpsubdomain']:\n\t Log.warn(self, \"Wildcard domains are not supported in Lets Encrypt.\\nWP SUBDOMAIN site will get SSL for primary site only.\")\n\n Log.info(self, \"Letsencrypt is currently in beta phase.\"\n \" \\nDo you wish\"\n \" to enable SSl now for {0}?\".format(ee_domain))\n\n # Check prompt\n check_prompt = input(\"Type \\\"y\\\" to continue [n]:\")\n if check_prompt != \"Y\" and check_prompt != \"y\":\n data['letsencrypt'] = False\n letsencrypt = False\n else:\n data['letsencrypt'] = True\n letsencrypt = True\n else:\n data['letsencrypt'] = True\n letsencrypt = True\n\n if data['letsencrypt'] is True:\n setupLetsEncrypt(self, ee_domain)\n httpsRedirect(self,ee_domain)\n Log.info(self,\"Creating Cron Job for cert auto-renewal\")\n EECron.setcron_weekly(self,'ee site update --le=renew --all 2> /dev/null'.format(ee_domain),'Renew all'\n ' letsencrypt SSL cert. Set by EasyEngine')\n\n if not EEService.reload_service(self, 'nginx'):\n Log.error(self, \"service nginx reload failed. \"\n \"check issues with `nginx -t` command\")\n\n Log.info(self, \"Congratulations! Successfully Configured SSl for Site \"\n \" https://{0}\".format(ee_domain))\n\n if (SSL.getExpirationDays(self,ee_domain)>0):\n Log.info(self, \"Your cert will expire within \" + str(SSL.getExpirationDays(self,ee_domain)) + \" days.\")\n else:\n Log.warn(self, \"Your cert already EXPIRED ! .PLEASE renew soon . \")\n\n # Add nginx conf folder into GIT\n EEGit.add(self, [\"{0}/conf/nginx\".format(ee_site_webroot)],\n msg=\"Adding letsencrypts config of site: {0}\"\n .format(ee_domain))\n updateSiteInfo(self, ee_domain, ssl=letsencrypt)\n\n elif data['letsencrypt'] is False:\n Log.info(self, \"Not using Let\\'s encrypt for Site \"\n \" http://{0}\".format(ee_domain))", "metadata": "root.EESiteCreateController.default", "header": "['class', 'EESiteCreateController', '(', 'CementBaseController', ')', ':', '___EOS___']", "index": 384 }, { "content": "class EESiteUpdateController(CementBaseController):\n class Meta:\n label = 'update'\n stacked_on = 'site'\n stacked_type = 'nested'\n description = ('This command updates websites configuration to '\n 'another as per the options are provided')\n arguments = [\n (['site_name'],\n dict(help='domain name for the site to be updated',\n nargs='?')),\n (['--password'],\n dict(help=\"update to password for wordpress site user\",\n action='store_true')),\n (['--html'],\n dict(help=\"update to html site\", action='store_true')),\n (['--php'],\n dict(help=\"update to php site\", action='store_true')),\n (['--php7'],\n dict(help=\"update to php7 site\",\n action='store' or 'store_const',\n choices=('on', 'off'), const='on', nargs='?')),\n (['--mysql'],\n dict(help=\"update to mysql site\", action='store_true')),\n (['--wp'],\n dict(help=\"update to wordpress single site\",\n action='store_true')),\n (['--wpsubdir'],\n dict(help=\"update to wpsubdir site\", action='store_true')),\n (['--wpsubdomain'],\n dict(help=\"update to wpsubdomain site\", action='store_true')),\n (['--w3tc'],\n dict(help=\"update to w3tc cache\", action='store_true')),\n (['--wpfc'],\n dict(help=\"update to wpfc cache\", action='store_true')),\n (['--wpsc'],\n dict(help=\"update to wpsc cache\", action='store_true')),\n (['--wpredis'],\n dict(help=\"update to redis cache\", action='store_true')),\n (['--hhvm'],\n dict(help='Use HHVM for site',\n action='store' or 'store_const',\n choices=('on', 'off'), const='on', nargs='?')),\n (['--pagespeed'],\n dict(help='Use PageSpeed for site',\n action='store' or 'store_const',\n choices=('on', 'off'), const='on', nargs='?')),\n (['-le','--letsencrypt'],\n dict(help=\"configure letsencrypt ssl for the site\",\n action='store' or 'store_const',\n choices=('on', 'off', 'renew'), const='on', nargs='?')),\n (['--proxy'],\n dict(help=\"update to proxy site\", nargs='+')),\n (['--experimental'],\n dict(help=\"Enable Experimenal packages without prompt\",\n action='store_true')),\n (['--all'],\n dict(help=\"update all sites\", action='store_true')),\n ]\n\n", "metadata": "root.EESiteUpdateController", "header": "['module', '___EOS___']", "index": 833 }, { "content": " @expose(help=\"Update site type or cache\")\n def default(self):\n pargs = self.app.pargs\n\n if pargs.all:\n if pargs.site_name:\n Log.error(self, \"`--all` option cannot be used with site name\"\n \" provided\")\n if pargs.html:\n Log.error(self, \"No site can be updated to html\")\n\n if not (pargs.php or pargs.php7 or\n pargs.mysql or pargs.wp or pargs.wpsubdir or\n pargs.wpsubdomain or pargs.w3tc or pargs.wpfc or\n pargs.wpsc or pargs.hhvm or pargs.pagespeed or pargs.wpredis or pargs.letsencrypt):\n Log.error(self, \"Please provide options to update sites.\")\n\n if pargs.all:\n if pargs.site_name:\n Log.error(self, \"`--all` option cannot be used with site name\"\n \" provided\")\n\n sites = getAllsites(self)\n if not sites:\n pass\n else:\n for site in sites:\n pargs.site_name = site.sitename\n Log.info(self, Log.ENDC + Log.BOLD + \"Updating site {0},\"\n \" please wait...\"\n .format(pargs.site_name))\n self.doupdatesite(pargs)\n print(\"\\n\")\n else:\n self.doupdatesite(pargs)", "metadata": "root.EESiteUpdateController.default", "header": "['class', 'EESiteUpdateController', '(', 'CementBaseController', ')', ':', '___EOS___']", "index": 893 }, { "content": " def doupdatesite(self, pargs):\n hhvm = None\n pagespeed = None\n letsencrypt = False\n php7 = None\n\n\n data = dict()\n try:\n stype, cache = detSitePar(vars(pargs))\n except RuntimeError as e:\n Log.debug(self, str(e))\n Log.error(self, \"Please provide valid options combination for\"\n \" site update\")\n\n if stype is None and pargs.proxy:\n stype, cache = 'proxy', ''\n proxyinfo = pargs.proxy[0].strip()\n if not proxyinfo:\n Log.error(self, \"Please provide proxy server host information\")\n proxyinfo = proxyinfo.split(':')\n host = proxyinfo[0].strip()\n port = '80' if len(proxyinfo) < 2 else proxyinfo[1].strip()\n elif stype is None and not (pargs.proxy or pargs.letsencrypt):\n stype, cache = 'html', 'basic'\n elif stype and pargs.proxy:\n Log.error(self, \"--proxy can not be used with other site types\")\n if (pargs.proxy and (pargs.pagespeed or pargs.hhvm)):\n Log.error(self, \"Proxy site can not run on pagespeed or hhvm\")\n\n if not pargs.site_name:\n try:\n while not pargs.site_name:\n pargs.site_name = (input('Enter site name : ').strip())\n except IOError as e:\n Log.error(self, 'Unable to input site name, Please try again!')\n\n pargs.site_name = pargs.site_name.strip()\n (ee_domain,\n ee_www_domain, ) = ValidateDomain(pargs.site_name)\n ee_site_webroot = EEVariables.ee_webroot + ee_domain\n\n check_site = getSiteInfo(self, ee_domain)\n\n if check_site is None:\n Log.error(self, \" Site {0} does not exist.\".format(ee_domain))\n else:\n oldsitetype = check_site.site_type\n oldcachetype = check_site.cache_type\n old_hhvm = check_site.is_hhvm\n old_pagespeed = check_site.is_pagespeed\n check_ssl = check_site.is_ssl\n check_php_version = check_site.php_version\n\n if check_php_version == \"7.0\":\n old_php7 = True\n else:\n old_php7 = False\n\n if (pargs.password and not (pargs.html or\n pargs.php or pargs.php7 or pargs.mysql or pargs.wp or\n pargs.w3tc or pargs.wpfc or pargs.wpsc\n or pargs.wpsubdir or pargs.wpsubdomain)):\n try:\n updatewpuserpassword(self, ee_domain, ee_site_webroot)\n except SiteError as e:\n Log.debug(self, str(e))\n Log.info(self, \"\\nPassword Unchanged.\")\n return 0\n\n if ((stype == \"proxy\" and stype == oldsitetype and self.app.pargs.hhvm)\n or (stype == \"proxy\" and\n stype == oldsitetype and self.app.pargs.pagespeed)):\n Log.info(self, Log.FAIL +\n \"Can not update proxy site to HHVM or Pagespeed\")\n return 1\n if stype == \"html\" and stype == oldsitetype and self.app.pargs.hhvm:\n Log.info(self, Log.FAIL + \"Can not update HTML site to HHVM\")\n return 1\n\n if ((stype == 'php' and oldsitetype not in ['html', 'proxy', 'php7']) or\n # (stype == 'php7' and oldsitetype not in ['html', 'mysql', 'php', 'php7', 'wp', 'wpsubdir', 'wpsubdomain', ]) or\n (stype == 'mysql' and oldsitetype not in ['html', 'php',\n 'proxy','php7']) or\n (stype == 'wp' and oldsitetype not in ['html', 'php', 'mysql',\n 'proxy', 'wp', 'php7']) or\n (stype == 'wpsubdir' and oldsitetype in ['wpsubdomain']) or\n (stype == 'wpsubdomain' and oldsitetype in ['wpsubdir']) or\n (stype == oldsitetype and cache == oldcachetype) and\n not (pargs.pagespeed or pargs.php7)):\n Log.info(self, Log.FAIL + \"can not update {0} {1} to {2} {3}\".\n format(oldsitetype, oldcachetype, stype, cache))\n return 1\n\n if stype == 'proxy':\n data['site_name'] = ee_domain\n data['www_domain'] = ee_www_domain\n data['proxy'] = True\n data['host'] = host\n data['port'] = port\n pagespeed = False\n hhvm = False\n data['webroot'] = ee_site_webroot\n data['currsitetype'] = oldsitetype\n data['currcachetype'] = oldcachetype\n\n if stype == 'php':\n data = dict(site_name=ee_domain, www_domain=ee_www_domain,\n static=False, basic=True, wp=False, w3tc=False,\n wpfc=False, wpsc=False, wpredis=False, multisite=False,\n wpsubdir=False, webroot=ee_site_webroot,\n currsitetype=oldsitetype, currcachetype=oldcachetype)\n\n elif stype in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']:\n\n data = dict(site_name=ee_domain, www_domain=ee_www_domain,\n static=False, basic=True, wp=False, w3tc=False,\n wpfc=False, wpsc=False, wpredis=False, multisite=False,\n wpsubdir=False, webroot=ee_site_webroot,\n ee_db_name='', ee_db_user='', ee_db_pass='',\n ee_db_host='',\n currsitetype=oldsitetype, currcachetype=oldcachetype)\n\n if stype in ['wp', 'wpsubdir', 'wpsubdomain']:\n data['wp'] = True\n data['basic'] = False\n data[cache] = True\n if stype in ['wpsubdir', 'wpsubdomain']:\n data['multisite'] = True\n if stype == 'wpsubdir':\n data['wpsubdir'] = True\n\n if pargs.pagespeed or pargs.hhvm or pargs.php7:\n if not data:\n data = dict(site_name=ee_domain, www_domain=ee_www_domain,\n currsitetype=oldsitetype,\n currcachetype=oldcachetype,\n webroot=ee_site_webroot)\n stype = oldsitetype\n cache = oldcachetype\n if oldsitetype == 'html' or oldsitetype == 'proxy':\n data['static'] = True\n data['wp'] = False\n data['multisite'] = False\n data['wpsubdir'] = False\n elif oldsitetype == 'php' or oldsitetype == 'mysql':\n data['static'] = False\n data['wp'] = False\n data['multisite'] = False\n data['wpsubdir'] = False\n elif oldsitetype == 'wp':\n data['static'] = False\n data['wp'] = True\n data['multisite'] = False\n data['wpsubdir'] = False\n elif oldsitetype == 'wpsubdir':\n data['static'] = False\n data['wp'] = True\n data['multisite'] = True\n data['wpsubdir'] = True\n elif oldsitetype == 'wpsubdomain':\n data['static'] = False\n data['wp'] = True\n data['multisite'] = True\n data['wpsubdir'] = False\n\n if oldcachetype == 'basic':\n data['basic'] = True\n data['w3tc'] = False\n data['wpfc'] = False\n data['wpsc'] = False\n data['wpredis'] = False\n elif oldcachetype == 'w3tc':\n data['basic'] = False\n data['w3tc'] = True\n data['wpfc'] = False\n data['wpsc'] = False\n data['wpredis'] = False\n elif oldcachetype == 'wpfc':\n data['basic'] = False\n data['w3tc'] = False\n data['wpfc'] = True\n data['wpsc'] = False\n data['wpredis'] = False\n elif oldcachetype == 'wpsc':\n data['basic'] = False\n data['w3tc'] = False\n data['wpfc'] = False\n data['wpsc'] = True\n data['wpredis'] = False\n elif oldcachetype == 'wpredis':\n data['basic'] = False\n data['w3tc'] = False\n data['wpfc'] = False\n data['wpsc'] = False\n data['wpredis'] = True\n\n if pargs.hhvm != 'off':\n data['hhvm'] = True\n hhvm = True\n elif pargs.hhvm == 'off':\n data['hhvm'] = False\n hhvm = False\n\n if pargs.pagespeed != 'off':\n data['pagespeed'] = True\n pagespeed = True\n elif pargs.pagespeed == 'off':\n data['pagespeed'] = False\n pagespeed = False\n\n if pargs.php7 == 'on' :\n data['php7'] = True\n php7 = True\n check_php_version= '7.0'\n elif pargs.php7 == 'off':\n data['php7'] = False\n php7 = False\n check_php_version = '5.6'\n\n if pargs.pagespeed:\n if pagespeed is old_pagespeed:\n if pagespeed is False:\n Log.info(self, \"Pagespeed is already disabled for given \"\n \"site\")\n elif pagespeed is True:\n Log.info(self, \"Pagespeed is already enabled for given \"\n \"site\")\n pargs.pagespeed = False\n\n if pargs.php7:\n if php7 is old_php7:\n if php7 is False:\n Log.info(self, \"PHP 7.0 is already disabled for given \"\n \"site\")\n elif php7 is True:\n Log.info(self, \"PHP 7.0 is already enabled for given \"\n \"site\")\n pargs.php7 = False\n\n #--letsencrypt=renew code goes here\n if pargs.letsencrypt == \"renew\" and not pargs.all:\n expiry_days = SSL.getExpirationDays(self,ee_domain)\n min_expiry_days = 30\n if check_ssl:\n if (expiry_days <= min_expiry_days):\n renewLetsEncrypt(self,ee_domain)\n else:\n Log.error(self,\"More than 30 days left for certificate Expiry. Not renewing now.\")\n\n else:\n Log.error(self,\"Cannot RENEW ! SSL is not configured for given site .\")\n\n Log.info(self, \"SUCCESS: Certificate was successfully renewed For\"\n \" https://{0}\".format(ee_domain))\n if (SSL.getExpirationDays(self,ee_domain)>0):\n Log.info(self, \"Your cert will expire within \" + str(SSL.getExpirationDays(self,ee_domain)) + \" days.\")\n Log.info(self, \"Expiration DATE: \" + str(SSL.getExpirationDate(self,ee_domain)))\n\n else:\n Log.warn(self, \"Your cert already EXPIRED !. PLEASE renew soon . \")\n\n if pargs.all and pargs.letsencrypt == \"renew\":\n\n if check_ssl:\n expiry_days = SSL.getExpirationDays(self,ee_domain,True)\n if expiry_days < 0:\n return 0\n min_expiry_days = 30\n if (expiry_days <= min_expiry_days):\n renewLetsEncrypt(self,ee_domain)\n Log.info(self, \"SUCCESS: Certificate was successfully renewed For\"\n \" https://{0}\".format(ee_domain))\n else:\n Log.info(self,\"More than 60 days left for certificate Expiry. Not renewing now.\\n\")\n\n if (SSL.getExpirationDays(self,ee_domain)>0):\n Log.info(self, \"Your cert will expire within \" + str(SSL.getExpirationDays(self,ee_domain)) + \" days.\")\n Log.info(self, \"Expiration DATE: \\n\\n\" + str(SSL.getExpirationDate(self,ee_domain)))\n return 0\n #else:\n # Log.warn(self, \"Your cert already EXPIRED ! .PLEASE renew soon . \")\n else:\n Log.info(self,\"SSL not configured for site http://{0}\".format(ee_domain))\n return 0\n\n if pargs.all and pargs.letsencrypt == \"off\":\n if letsencrypt is check_ssl:\n if letsencrypt is False:\n Log.error(self, \"SSl is not configured for given \"\n \"site\",False)\n return 0\n\n if pargs.letsencrypt:\n if pargs.letsencrypt == 'on':\n data['letsencrypt'] = True\n letsencrypt = True\n elif pargs.letsencrypt == 'off':\n data['letsencrypt'] = False\n letsencrypt = False\n\n if letsencrypt is check_ssl:\n if letsencrypt is False:\n Log.error(self, \"SSl is not configured for given \"\n \"site\")\n elif letsencrypt is True:\n Log.error(self, \"SSl is already configured for given \"\n \"site\")\n pargs.letsencrypt = False\n\n if pargs.hhvm:\n if hhvm is old_hhvm:\n if hhvm is False:\n Log.info(self, \"HHVM is allready disabled for given \"\n \"site\")\n elif hhvm is True:\n Log.info(self, \"HHVM is allready enabled for given \"\n \"site\")\n\n pargs.hhvm = False\n\n if data and (not pargs.hhvm):\n if old_hhvm is True:\n data['hhvm'] = True\n hhvm = True\n else:\n data['hhvm'] = False\n hhvm = False\n\n if data and (not pargs.pagespeed):\n if old_pagespeed is True:\n data['pagespeed'] = True\n pagespeed = True\n else:\n data['pagespeed'] = False\n pagespeed = False\n\n if data and (not pargs.php7):\n if old_php7 is True:\n data['php7'] = True\n php7 = True\n else:\n data['php7'] = False\n php7 = False\n\n if pargs.pagespeed==\"on\" or pargs.hhvm==\"on\" or pargs.letsencrypt==\"on\" or pargs.php7==\"on\":\n if pargs.php7 == \"on\":\n if (not pargs.experimental):\n Log.info(self, \"PHP7.0 is experimental feature and it may not\"\n \" work with all plugins of your site.\\nYou can \"\n \"disable it by passing --php7=off later.\\nDo you wish\"\n \" to enable PHP now for {0}?\".format(ee_domain))\n\n # Check prompt\n check_prompt = input(\"Type \\\"y\\\" to continue [n]:\")\n if check_prompt != \"Y\" and check_prompt != \"y\":\n Log.info(self, \"Not using PHP 7.0 for site\")\n data['php7'] = False\n php7 = False\n else:\n data['php7'] = True\n php7 = True\n else:\n data['php7'] = True\n php7 = True\n\n if pargs.hhvm == \"on\":\n if (not pargs.experimental):\n Log.info(self, \"HHVM is experimental feature and it may not\"\n \" work with all plugins of your site.\\nYou can \"\n \"disable it by passing --hhvm=off later.\\nDo you wish\"\n \" to enable HHVM now for {0}?\".format(ee_domain))\n\n # Check prompt\n check_prompt = input(\"Type \\\"y\\\" to continue [n]:\")\n if check_prompt != \"Y\" and check_prompt != \"y\":\n Log.info(self, \"Not using HHVM for site\")\n data['hhvm'] = False\n hhvm = False\n else:\n data['hhvm'] = True\n hhvm = True\n else:\n data['hhvm'] = True\n hhvm = True\n\n if pargs.pagespeed==\"on\":\n if (not pargs.experimental):\n Log.info(self, \"PageSpeed is experimental feature and it may not\"\n \" work with all CSS/JS/Cache of your site.\\nYou can \"\n \"disable it by passing --pagespeed=off later.\\nDo you wish\"\n \" to enable PageSpeed now for {0}?\".format(ee_domain))\n\n # Check prompt\n check_prompt = input(\"Type \\\"y\\\" to continue [n]:\")\n if check_prompt != \"Y\" and check_prompt != \"y\":\n Log.info(self, \"Not using Pagespeed for given site\")\n data['pagespeed'] = False\n pagespeed = False\n else:\n data['pagespeed'] = True\n pagespeed = True\n else:\n data['pagespeed'] = True\n pagespeed = True\n\n if pargs.letsencrypt == \"on\":\n\n if (not pargs.experimental):\n\n if oldsitetype in ['wpsubdomain']:\n\t Log.warn(self, \"Wildcard domains are not supported in Lets Encrypt.\\nWP SUBDOMAIN site will get SSL for primary site only.\")\n\n Log.info(self, \"Letsencrypt is currently in beta phase.\"\n \" \\nDo you wish\"\n \" to enable SSl now for {0}?\".format(ee_domain))\n\n # Check prompt\n check_prompt = input(\"Type \\\"y\\\" to continue [n]:\")\n if check_prompt != \"Y\" and check_prompt != \"y\":\n Log.info(self, \"Not using letsencrypt for site\")\n data['letsencrypt'] = False\n letsencrypt = False\n else:\n data['letsencrypt'] = True\n letsencrypt = True\n else:\n data['letsencrypt'] = True\n letsencrypt = True\n\n\n\n if pargs.wpredis and data['currcachetype'] != 'wpredis':\n if (not pargs.experimental):\n Log.info(self, \"Redis is experimental feature and it may not\"\n \" work with all plugins of your site.\\nYou can \"\n \"disable it by changing cache type later.\\nDo you wish\"\n \" to enable Redis now for {0}?\".format(ee_domain))\n\n # Check prompt\n check_prompt = input(\"Type \\\"y\\\" to continue [n]: \")\n if check_prompt != \"Y\" and check_prompt != \"y\":\n Log.error(self, \"Not using Redis for site\")\n data['wpredis'] = False\n data['basic'] = True\n cache = 'basic'\n\n if ((hhvm is old_hhvm) and (pagespeed is old_pagespeed) and (php7 is old_php7) and\n (stype == oldsitetype and cache == oldcachetype)):\n return 1\n\n if not data:\n Log.error(self, \"Cannot update {0}, Invalid Options\"\n .format(ee_domain))\n\n ee_auth = site_package_check(self, stype)\n data['ee_db_name'] = check_site.db_name\n data['ee_db_user'] = check_site.db_user\n data['ee_db_pass'] = check_site.db_password\n data['ee_db_host'] = check_site.db_host\n data['old_pagespeed_status'] = check_site.is_pagespeed\n\n if not pargs.letsencrypt:\n try:\n pre_run_checks(self)\n except SiteError as e:\n Log.debug(self, str(e))\n Log.error(self, \"NGINX configuration check failed.\")\n\n try:\n sitebackup(self, data)\n except Exception as e:\n Log.debug(self, str(e))\n Log.info(self, Log.FAIL + \"Check logs for reason \"\n \"`tail /var/log/ee/ee.log` & Try Again!!!\")\n return 1\n\n # setup NGINX configuration, and webroot\n try:\n setupdomain(self, data)\n except SiteError as e:\n Log.debug(self, str(e))\n Log.info(self, Log.FAIL + \"Update site failed.\"\n \"Check logs for reason\"\n \"`tail /var/log/ee/ee.log` & Try Again!!!\")\n return 1\n\n if 'proxy' in data.keys() and data['proxy']:\n updateSiteInfo(self, ee_domain, stype=stype, cache=cache,\n hhvm=hhvm, pagespeed=pagespeed,ssl=True if check_site.is_ssl else False)\n Log.info(self, \"Successfully updated site\"\n \" http://{0}\".format(ee_domain))\n return 0\n\n # Update pagespeed config\n if pargs.pagespeed:\n operateOnPagespeed(self, data)\n\n if pargs.letsencrypt:\n if data['letsencrypt'] is True:\n if not os.path.isfile(\"{0}/conf/nginx/ssl.conf.disabled\"\n .format(ee_site_webroot)):\n setupLetsEncrypt(self, ee_domain)\n\n else:\n EEFileUtils.mvfile(self, \"{0}/conf/nginx/ssl.conf.disabled\"\n .format(ee_site_webroot),\n '{0}/conf/nginx/ssl.conf'\n .format(ee_site_webroot))\n\n httpsRedirect(self,ee_domain)\n Log.info(self,\"Creating Cron Job for cert auto-renewal\")\n EECron.setcron_weekly(self,'ee site update --le=renew --all 2> /dev/null'.format(ee_domain),'Renew all'\n ' letsencrypt SSL cert. Set by EasyEngine')\n\n if not EEService.reload_service(self, 'nginx'):\n Log.error(self, \"service nginx reload failed. \"\n \"check issues with `nginx -t` command\")\n\n Log.info(self, \"Congratulations! Successfully Configured SSl for Site \"\n \" https://{0}\".format(ee_domain))\n\n if (SSL.getExpirationDays(self,ee_domain)>0):\n Log.info(self, \"Your cert will expire within \" + str(SSL.getExpirationDays(self,ee_domain)) + \" days.\")\n else:\n Log.warn(self, \"Your cert already EXPIRED ! .PLEASE renew soon . \")\n\n elif data['letsencrypt'] is False:\n if os.path.isfile(\"{0}/conf/nginx/ssl.conf\"\n .format(ee_site_webroot)):\n Log.info(self,'Setting Nginx configuration')\n EEFileUtils.mvfile(self, \"{0}/conf/nginx/ssl.conf\"\n .format(ee_site_webroot),\n '{0}/conf/nginx/ssl.conf.disabled'\n .format(ee_site_webroot))\n httpsRedirect(self,ee_domain,False)\n if not EEService.reload_service(self, 'nginx'):\n Log.error(self, \"service nginx reload failed. \"\n \"check issues with `nginx -t` command\")\n #Log.info(self,\"Removing Cron Job set for cert auto-renewal\")\n #EECron.remove_cron(self,'ee site update {0} --le=renew --min_expiry_limit 30 2> \\/dev\\/null'.format(ee_domain))\n Log.info(self, \"Successfully Disabled SSl for Site \"\n \" http://{0}\".format(ee_domain))\n\n\n # Add nginx conf folder into GIT\n EEGit.add(self, [\"{0}/conf/nginx\".format(ee_site_webroot)],\n msg=\"Adding letsencrypts config of site: {0}\"\n .format(ee_domain))\n updateSiteInfo(self, ee_domain, ssl=letsencrypt)\n return 0\n\n if stype == oldsitetype and cache == oldcachetype:\n\n # Service Nginx Reload\n if not EEService.reload_service(self, 'nginx'):\n Log.error(self, \"service nginx reload failed. \"\n \"check issues with `nginx -t` command\")\n\n updateSiteInfo(self, ee_domain, stype=stype, cache=cache,\n hhvm=hhvm, pagespeed=pagespeed,ssl=True if check_site.is_ssl else False, php_version=check_php_version)\n\n Log.info(self, \"Successfully updated site\"\n \" http://{0}\".format(ee_domain))\n return 0\n\n #if data['ee_db_name'] and not data['wp']:\n if 'ee_db_name' in data.keys() and not data['wp']:\n try:\n data = setupdatabase(self, data)\n except SiteError as e:\n Log.debug(self, str(e))\n Log.info(self, Log.FAIL + \"Update site failed.\"\n \"Check logs for reason\"\n \"`tail /var/log/ee/ee.log` & Try Again!!!\")\n return 1\n try:\n eedbconfig = open(\"{0}/ee-config.php\".format(ee_site_webroot),\n encoding='utf-8', mode='w')\n eedbconfig.write(\"<?php \\ndefine('DB_NAME', '{0}');\"\n \"\\ndefine('DB_USER', '{1}'); \"\n \"\\ndefine('DB_PASSWORD', '{2}');\"\n \"\\ndefine('DB_HOST', '{3}');\\n?>\"\n .format(data['ee_db_name'],\n data['ee_db_user'],\n data['ee_db_pass'],\n data['ee_db_host']))\n eedbconfig.close()\n except IOError as e:\n Log.debug(self, str(e))\n Log.debug(self, \"creating ee-config.php failed.\")\n Log.info(self, Log.FAIL + \"Update site failed. \"\n \"Check logs for reason \"\n \"`tail /var/log/ee/ee.log` & Try Again!!!\")\n return 1\n\n # Setup WordPress if old sites are html/php/mysql sites\n if data['wp'] and oldsitetype in ['html', 'proxy', 'php', 'mysql']:\n try:\n ee_wp_creds = setupwordpress(self, data)\n except SiteError as e:\n Log.debug(self, str(e))\n Log.info(self, Log.FAIL + \"Update site failed.\"\n \"Check logs for reason \"\n \"`tail /var/log/ee/ee.log` & Try Again!!!\")\n return 1\n\n # Uninstall unnecessary plugins\n if oldsitetype in ['wp', 'wpsubdir', 'wpsubdomain']:\n # Setup WordPress Network if update option is multisite\n # and oldsite is WordPress single site\n if data['multisite'] and oldsitetype == 'wp':\n try:\n setupwordpressnetwork(self, data)\n except SiteError as e:\n Log.debug(self, str(e))\n Log.info(self, Log.FAIL + \"Update site failed. \"\n \"Check logs for reason\"\n \" `tail /var/log/ee/ee.log` & Try Again!!!\")\n return 1\n\n if (oldcachetype == 'w3tc' or oldcachetype == 'wpfc' and\n not (data['w3tc'] or data['wpfc'])):\n try:\n uninstallwp_plugin(self, 'w3-total-cache', data)\n except SiteError as e:\n Log.debug(self, str(e))\n Log.info(self, Log.FAIL + \"Update site failed. \"\n \"Check logs for reason\"\n \" `tail /var/log/ee/ee.log` & Try Again!!!\")\n return 1\n\n if ((oldcachetype in ['w3tc', 'wpsc', 'basic', 'wpredis'] and\n (data['wpfc'])) or (oldsitetype == 'wp' and data['multisite'] and data['wpfc'])):\n try:\n plugin_data = '{\"log_level\":\"INFO\",\"log_filesize\":5,\"enable_purge\":1,\"enable_map\":0,\"enable_log\":0,\"enable_stamp\":0,\"purge_homepage_on_new\":1,\"purge_homepage_on_edit\":1,\"purge_homepage_on_del\":1,\"purge_archive_on_new\":1,\"purge_archive_on_edit\":0,\"purge_archive_on_del\":0,\"purge_archive_on_new_comment\":0,\"purge_archive_on_deleted_comment\":0,\"purge_page_on_mod\":1,\"purge_page_on_new_comment\":1,\"purge_page_on_deleted_comment\":1,\"cache_method\":\"enable_fastcgi\",\"purge_method\":\"get_request\",\"redis_hostname\":\"127.0.0.1\",\"redis_port\":\"6379\",\"redis_prefix\":\"nginx-cache:\"}'\n setupwp_plugin(self, 'nginx-helper', 'rt_wp_nginx_helper_options', plugin_data, data)\n except SiteError as e:\n Log.debug(self, str(e))\n Log.info(self, Log.FAIL + \"Update nginx-helper settings failed. \"\n \"Check logs for reason\"\n \" `tail /var/log/ee/ee.log` & Try Again!!!\")\n return 1\n\n elif ((oldcachetype in ['w3tc', 'wpsc', 'basic', 'wpfc'] and\n (data['wpredis'])) or (oldsitetype == 'wp' and data['multisite'] and data['wpredis'])):\n try:\n plugin_data = '{\"log_level\":\"INFO\",\"log_filesize\":5,\"enable_purge\":1,\"enable_map\":0,\"enable_log\":0,\"enable_stamp\":0,\"purge_homepage_on_new\":1,\"purge_homepage_on_edit\":1,\"purge_homepage_on_del\":1,\"purge_archive_on_new\":1,\"purge_archive_on_edit\":0,\"purge_archive_on_del\":0,\"purge_archive_on_new_comment\":0,\"purge_archive_on_deleted_comment\":0,\"purge_page_on_mod\":1,\"purge_page_on_new_comment\":1,\"purge_page_on_deleted_comment\":1,\"cache_method\":\"enable_redis\",\"purge_method\":\"get_request\",\"redis_hostname\":\"127.0.0.1\",\"redis_port\":\"6379\",\"redis_prefix\":\"nginx-cache:\"}'\n setupwp_plugin(self, 'nginx-helper', 'rt_wp_nginx_helper_options', plugin_data, data)\n except SiteError as e:\n Log.debug(self, str(e))\n Log.info(self, Log.FAIL + \"Update nginx-helper settings failed. \"\n \"Check logs for reason\"\n \" `tail /var/log/ee/ee.log` & Try Again!!!\")\n return 1\n else:\n try:\n plugin_data = '{\"log_level\":\"INFO\",\"log_filesize\":5,\"enable_purge\":0,\"enable_map\":0,\"enable_log\":0,\"enable_stamp\":0,\"purge_homepage_on_new\":1,\"purge_homepage_on_edit\":1,\"purge_homepage_on_del\":1,\"purge_archive_on_new\":1,\"purge_archive_on_edit\":0,\"purge_archive_on_del\":0,\"purge_archive_on_new_comment\":0,\"purge_archive_on_deleted_comment\":0,\"purge_page_on_mod\":1,\"purge_page_on_new_comment\":1,\"purge_page_on_deleted_comment\":1,\"cache_method\":\"enable_redis\",\"purge_method\":\"get_request\",\"redis_hostname\":\"127.0.0.1\",\"redis_port\":\"6379\",\"redis_prefix\":\"nginx-cache:\"}'\n setupwp_plugin(self, 'nginx-helper', 'rt_wp_nginx_helper_options', plugin_data, data)\n except SiteError as e:\n Log.debug(self, str(e))\n Log.info(self, Log.FAIL + \"Update nginx-helper settings failed. \"\n \"Check logs for reason\"\n \" `tail /var/log/ee/ee.log` & Try Again!!!\")\n return 1\n\n if oldcachetype == 'wpsc' and not data['wpsc']:\n try:\n uninstallwp_plugin(self, 'wp-super-cache', data)\n except SiteError as e:\n Log.debug(self, str(e))\n Log.info(self, Log.FAIL + \"Update site failed.\"\n \"Check logs for reason\"\n \" `tail /var/log/ee/ee.log` & Try Again!!!\")\n return 1\n\n if oldcachetype == 'wpredis' and not data['wpredis']:\n try:\n uninstallwp_plugin(self, 'redis-cache', data)\n except SiteError as e:\n Log.debug(self, str(e))\n Log.info(self, Log.FAIL + \"Update site failed.\"\n \"Check logs for reason\"\n \" `tail /var/log/ee/ee.log` & Try Again!!!\")\n return 1\n\n if (oldcachetype != 'w3tc' or oldcachetype != 'wpfc') and (data['w3tc']\n or data['wpfc']):\n try:\n installwp_plugin(self, 'w3-total-cache', data)\n except SiteError as e:\n Log.debug(self, str(e))\n Log.info(self, Log.FAIL + \"Update site failed.\"\n \"Check logs for reason\"\n \" `tail /var/log/ee/ee.log` & Try Again!!!\")\n return 1\n\n if oldcachetype != 'wpsc' and data['wpsc']:\n try:\n installwp_plugin(self, 'wp-super-cache', data)\n except SiteError as e:\n Log.debug(self, str(e))\n Log.info(self, Log.FAIL + \"Update site failed.\"\n \"Check logs for reason \"\n \"`tail /var/log/ee/ee.log` & Try Again!!!\")\n return 1\n\n if oldcachetype != 'wpredis' and data['wpredis']:\n try:\n if installwp_plugin(self, 'redis-cache', data):\n #search for wp-config.php\n if EEFileUtils.isexist(self,\"{0}/wp-config.php\".format(ee_site_webroot)):\n config_path = '{0}/wp-config.php'.format(ee_site_webroot)\n elif EEFileUtils.isexist(self,\"{0}/htdocs/wp-config.php\".format(ee_site_webroot)):\n config_path = '{0}/htdocs/wp-config.php'.format(ee_site_webroot)\n else:\n Log.debug(self, \"Updating wp-config.php failed. File could not be located.\")\n Log.error(self,\"wp-config.php could not be located !!\")\n raise SiteError\n\n if EEShellExec.cmd_exec(self, \"grep -q \\\"WP_CACHE_KEY_SALT\\\" {0}\"\n .format(config_path)):\n pass\n else:\n try:\n wpconfig = open(\"{0}\".format(config_path),\n encoding='utf-8', mode='a')\n wpconfig.write(\"\\n\\ndefine( \\'WP_CACHE_KEY_SALT\\', \\'{0}:\\' );\"\n .format(ee_domain))\n wpconfig.close()\n except IOError as e:\n Log.debug(self, str(e))\n Log.debug(self, \"Updating wp-config.php failed.\")\n Log.warn(self, \"Updating wp-config.php failed. \"\n \"Could not append:\"\n \"\\ndefine( \\'WP_CACHE_KEY_SALT\\', \\'{0}:\\' );\".format(ee_domain) +\n \"\\nPlease add manually\")\n except SiteError as e:\n Log.debug(self, str(e))\n Log.info(self, Log.FAIL + \"Update site failed.\"\n \"Check logs for reason \"\n \"`tail /var/log/ee/ee.log` & Try Again!!!\")\n return 1\n\n # Service Nginx Reload\n if not EEService.reload_service(self, 'nginx'):\n Log.error(self, \"service nginx reload failed. \"\n \"check issues with `nginx -t` command\")\n\n EEGit.add(self, [\"/etc/nginx\"],\n msg=\"{0} updated with {1} {2}\"\n .format(ee_www_domain, stype, cache))\n # Setup Permissions for webroot\n try:\n setwebrootpermissions(self, data['webroot'])\n except SiteError as e:\n Log.debug(self, str(e))\n Log.info(self, Log.FAIL + \"Update site failed.\"\n \"Check logs for reason \"\n \"`tail /var/log/ee/ee.log` & Try Again!!!\")\n return 1\n\n if ee_auth and len(ee_auth):\n for msg in ee_auth:\n Log.info(self, Log.ENDC + msg)\n\n display_cache_settings(self, data)\n if data['wp'] and oldsitetype in ['html', 'php', 'mysql']:\n Log.info(self, \"\\n\\n\" + Log.ENDC + \"WordPress admin user :\"\n \" {0}\".format(ee_wp_creds['wp_user']))\n Log.info(self, Log.ENDC + \"WordPress admin password : {0}\"\n .format(ee_wp_creds['wp_pass']) + \"\\n\\n\")\n if oldsitetype in ['html', 'php'] and stype != 'php':\n updateSiteInfo(self, ee_domain, stype=stype, cache=cache,\n db_name=data['ee_db_name'],\n db_user=data['ee_db_user'],\n db_password=data['ee_db_pass'],\n db_host=data['ee_db_host'], hhvm=hhvm,\n pagespeed=pagespeed,ssl=True if check_site.is_ssl else False,php_version=check_php_version)\n else:\n updateSiteInfo(self, ee_domain, stype=stype, cache=cache,\n hhvm=hhvm, pagespeed=pagespeed,ssl=True if check_site.is_ssl else False,php_version=check_php_version)\n Log.info(self, \"Successfully updated site\"\n \" http://{0}\".format(ee_domain))\n return 0", "metadata": "root.EESiteUpdateController.doupdatesite", "header": "['class', 'EESiteUpdateController', '(', 'CementBaseController', ')', ':', '___EOS___']", "index": 929 }, { "content": "class EESiteDeleteController(CementBaseController):\n class Meta:\n label = 'delete'\n stacked_on = 'site'\n stacked_type = 'nested'\n description = 'delete an existing website'\n arguments = [\n (['site_name'],\n dict(help='domain name to be deleted', nargs='?')),\n (['--no-prompt'],\n dict(help=\"doesnt ask permission for delete\",\n action='store_true')),\n (['-f','--force'],\n dict(help=\"forcefully delete site and configuration\",\n action='store_true')),\n (['--all'],\n dict(help=\"delete all\", action='store_true')),\n (['--db'],\n dict(help=\"delete db only\", action='store_true')),\n (['--files'],\n dict(help=\"delete webroot only\", action='store_true')),\n ]\n", "metadata": "root.EESiteDeleteController", "header": "['module', '___EOS___']", "index": 1716 }, { "content": " @expose(help=\"Delete website configuration and files\")\n @expose(hide=True)\n def default(self):\n if not self.app.pargs.site_name:\n try:\n while not self.app.pargs.site_name:\n self.app.pargs.site_name = (input('Enter site name : ')\n .strip())\n except IOError as e:\n Log.error(self, 'could not input site name')\n\n self.app.pargs.site_name = self.app.pargs.site_name.strip()\n (ee_domain, ee_www_domain) = ValidateDomain(self.app.pargs.site_name)\n ee_db_name = ''\n ee_prompt = ''\n ee_nginx_prompt = ''\n mark_db_delete_prompt = False\n mark_webroot_delete_prompt = False\n mark_db_deleted = False\n mark_webroot_deleted = False\n if not check_domain_exists(self, ee_domain):\n Log.error(self, \"site {0} does not exist\".format(ee_domain))\n\n if ((not self.app.pargs.db) and (not self.app.pargs.files) and\n (not self.app.pargs.all)):\n self.app.pargs.all = True\n\n # Gather information from ee-db for ee_domain\n check_site = getSiteInfo(self, ee_domain)\n ee_site_type = check_site.site_type\n ee_site_webroot = check_site.site_path\n if ee_site_webroot == 'deleted':\n mark_webroot_deleted = True\n if ee_site_type in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']:\n ee_db_name = check_site.db_name\n ee_db_user = check_site.db_user\n ee_mysql_grant_host = self.app.config.get('mysql', 'grant-host')\n if ee_db_name == 'deleted':\n mark_db_deleted = True\n if self.app.pargs.all:\n self.app.pargs.db = True\n self.app.pargs.files = True\n else:\n if self.app.pargs.all:\n mark_db_deleted = True\n self.app.pargs.files = True\n\n # Delete website database\n if self.app.pargs.db:\n if ee_db_name != 'deleted' and ee_db_name != '':\n if not self.app.pargs.no_prompt:\n ee_db_prompt = input('Are you sure, you want to delete'\n ' database [y/N]: ')\n else:\n ee_db_prompt = 'Y'\n mark_db_delete_prompt = True\n\n if ee_db_prompt == 'Y' or ee_db_prompt == 'y':\n mark_db_delete_prompt = True\n Log.info(self, \"Deleting Database, {0}, user {1}\"\n .format(ee_db_name, ee_db_user))\n deleteDB(self, ee_db_name, ee_db_user, ee_mysql_grant_host, False)\n updateSiteInfo(self, ee_domain,\n db_name='deleted',\n db_user='deleted',\n db_password='deleted')\n mark_db_deleted = True\n Log.info(self, \"Deleted Database successfully.\")\n else:\n mark_db_deleted = True\n Log.info(self, \"Does not seems to have database for this site.\"\n )\n\n # Delete webroot\n if self.app.pargs.files:\n if ee_site_webroot != 'deleted':\n if not self.app.pargs.no_prompt:\n ee_web_prompt = input('Are you sure, you want to delete '\n 'webroot [y/N]: ')\n else:\n ee_web_prompt = 'Y'\n mark_webroot_delete_prompt = True\n\n if ee_web_prompt == 'Y' or ee_web_prompt == 'y':\n mark_webroot_delete_prompt = True\n Log.info(self, \"Deleting Webroot, {0}\"\n .format(ee_site_webroot))\n deleteWebRoot(self, ee_site_webroot)\n updateSiteInfo(self, ee_domain, webroot='deleted')\n mark_webroot_deleted = True\n Log.info(self, \"Deleted webroot successfully\")\n else:\n mark_webroot_deleted = True\n Log.info(self, \"Webroot seems to be already deleted\")\n\n if not self.app.pargs.force:\n if (mark_webroot_deleted and mark_db_deleted):\n # TODO Delete nginx conf\n removeNginxConf(self, ee_domain)\n deleteSiteInfo(self, ee_domain)\n Log.info(self, \"Deleted site {0}\".format(ee_domain))\n # else:\n # Log.error(self, \" site {0} does not exists\".format(ee_domain))\n else:\n if (mark_db_delete_prompt or mark_webroot_delete_prompt or (mark_webroot_deleted and mark_db_deleted)):\n # TODO Delete nginx conf\n removeNginxConf(self, ee_domain)\n deleteSiteInfo(self, ee_domain)\n Log.info(self, \"Deleted site {0}\".format(ee_domain))", "metadata": "root.EESiteDeleteController.default", "header": "['class', 'EESiteDeleteController', '(', 'CementBaseController', ')', ':', '___EOS___']", "index": 1739 }, { "content": "class EESiteListController(CementBaseController):\n class Meta:\n label = 'list'\n stacked_on = 'site'\n stacked_type = 'nested'\n description = 'List websites'\n arguments = [\n (['--enabled'],\n dict(help='List enabled websites', action='store_true')),\n (['--disabled'],\n dict(help=\"List disabled websites\", action='store_true')),\n ]\n", "metadata": "root.EESiteListController", "header": "['module', '___EOS___']", "index": 1850 }, { "content": " @expose(help=\"Lists websites\")\n def default(self):\n sites = getAllsites(self)\n if not sites:\n pass\n\n if self.app.pargs.enabled:\n for site in sites:\n if site.is_enabled:\n Log.info(self, \"{0}\".format(site.sitename))\n elif self.app.pargs.disabled:\n for site in sites:\n if not site.is_enabled:\n Log.info(self, \"{0}\".format(site.sitename))\n else:\n for site in sites:\n Log.info(self, \"{0}\".format(site.sitename))", "metadata": "root.EESiteListController.default", "header": "['class', 'EESiteListController', '(', 'CementBaseController', ')', ':', '___EOS___']", "index": 1863 }, { "content": "def load(app):\n # register the plugin class.. this only happens if the plugin is enabled\n handler.register(EESiteController)\n handler.register(EESiteCreateController)\n handler.register(EESiteUpdateController)\n handler.register(EESiteDeleteController)\n handler.register(EESiteListController)\n handler.register(EESiteEditController)\n # register a hook (function) to run after arguments are parsed.\n hook.register('post_argument_parsing', ee_site_hook)", "metadata": "root.load", "header": "['module', '___EOS___']", "index": 1882 } ]
[ { "span": "from subprocess import Popen", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 28 }, { "span": "import sys", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 10 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "\"\"\"", "Eas", "y", "Engine", " ", "site", " ", "controlle", "r", ".\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "cem", "ent_", "._", "core_", "._", "controller_", "import_", "Ce", "ment", "Base", "Controller_", ",_", "expose_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "cem", "ent_", "._", "core_", "import_", "handler_", ",_", "hook_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ee_", "._", "core_", "._", "cron_", "import_", "EE", "Cro", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ee_", "._", "core_", "._", "ssl", "utils_", "import_", "SSL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ee_", "._", "core_", "._", "variables_", "import_", "EE", "Variables_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ee_", "._", "core_", "._", "domain", "validate_", "import_", "Validate", "Domain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ee_", "._", "core_", "._", "fileu", "tils_", "import_", "EE", "File", "Utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ee_", "._", "cli_", "._", "plugins_", "._", "site", "\\u", "functions_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ee_", "._", "core_", "._", "services_", "import_", "EE", "Service_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ee_", "._", "cli_", "._", "plugins_", "._", "site", "db_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ee_", "._", "core_", "._", "git_", "import_", "EE", "Git", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "subprocess_", "import_", "Popen_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ee_", "._", "core_", "._", "ngin", "xh", "ash", "bucket_", "import_", "hash", "bucket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "glob_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\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\\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_", "def_", "ee", "\\u", "site", "\\u", "hook_", "(_", "app_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "do", " ", "somet", "hing", " ", "with", " ", "the", " ", "``", "app", "``", " ", "object", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "ee_", "._", "core_", "._", "database_", "import_", "init", "\\u", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "ee_", "._", "cli_", "._", "plugins_", "._", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "init", "\\u", "db_", "(_", "app_", ")_", "\\u\\u\\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_", "EE", "Site", "Controller_", "(_", "Ce", "ment", "Base", "Controller_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "label_", "=_", "'", "site", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stacked", "\\u", "on_", "=_", "'", "base", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stacked", "\\u", "type_", "=_", "'", "nest", "ed", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "description_", "=_", "(_", "'", "Perform", "s", " ", "webs", "ite", " ", "specific", " ", "operati", "ons", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arguments_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'", "site", "\\u", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "'", "Webs", "ite", " ", "name", "'_", ",_", "nargs_", "=_", "'?'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "usage_", "=_", "\"", "ee", " ", "site", " ", "(", "command", ")", " ", "<", "site", "\\u", "name", ">", " ", "[", "options", "]\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "EE", "Site", "Controller_", "(_", "Ce", "ment", "Base", "Controller_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "expose_", "(_", "hide_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "default_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "app_", "._", "args_", "._", "print", "\\u", "help_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "EE", "Site", "Controller_", "(_", "Ce", "ment", "Base", "Controller_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "expose_", "(_", "help_", "=_", "\"", "Enable", " ", "site", " ", "example", ".", "com", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "enable_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "not_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", "=_", "(_", "input_", "(_", "'", "Enter", " ", "site", " ", "name", " ", ":", " ", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "strip_", "(_", ")_", ")_", "\\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 ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "'", "coul", "d", " ", "not", " ", "input", " ", "site", " ", "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_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", "=_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "validat", "e", " ", "domain", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "ee", "\\u", "domain_", ",_", "ee", "\\u", "www", "\\u", "domain_", ")_", "=_", "Validate", "Domain_", "(_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "if", " ", "site", " ", "exists_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "check", "\\u", "domain", "\\u", "exists_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "site", " ", "{", "0", "}", " ", "doe", "s", " ", "not", " ", "exist", "\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "'/", "etc", "/", "ngin", "x", "/", "sites", "-", "avail", "able", "/{", "0", "}'_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Enable", " ", "domain", " ", "{", "0", ":", "10", "}", " ", "\\\\", "t", "\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ",_", "end_", "=_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EE", "File", "Utils_", "._", "create", "\\u", "symlink_", "(_", "self_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'/", "etc", "/", "ngin", "x", "/", "sites", "-", "avail", "able", "/{", "0", "}'_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "etc", "/", "ngin", "x", "/", "sites", "-", "enable", "d", "/{", "0", "}'_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EE", "Git", "_", "._", "add_", "(_", "self_", ",_", "[_", "\"/", "etc", "/", "ngin", "x", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "=_", "\"", "Enable", "d", " ", "{", "0", "}", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Site", "Info_", "(_", "self_", ",_", "ee", "\\u", "domain_", ",_", "enabled_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "\"[\"_", "+_", "Log_", "._", "ENDC_", "+_", "\"", "OK", "\"_", "+_", "Log_", "._", "OK", "BLUE_", "+_", "\"]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "EE", "Service_", "._", "relo", "ad", "\\u", "service_", "(_", "self_", ",_", "'", "ngin", "x", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "service", " ", "ngin", "x", " ", "relo", "ad", " ", "fail", "ed", ".", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "check", " ", "issue", "s", " ", "with", " ", "`", "ngin", "x", " ", "-", "t", "`", " ", "command", "\"_", ")_", "\\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 ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "ngin", "x", " ", "configura", "tion", " ", "file", " ", "doe", "s", " ", "not", " ", "exist", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "EE", "Site", "Controller_", "(_", "Ce", "ment", "Base", "Controller_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "expose_", "(_", "help_", "=_", "\"", "Disa", "ble", " ", "site", " ", "example", ".", "com", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "disable_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "not_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", "=_", "(_", "input_", "(_", "'", "Enter", " ", "site", " ", "name", " ", ":", " ", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "strip_", "(_", ")_", ")_", "\\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_", "IO", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "'", "coul", "d", " ", "not", " ", "input", " ", "site", " ", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", "=_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "ee", "\\u", "domain_", ",_", "ee", "\\u", "www", "\\u", "domain_", ")_", "=_", "Validate", "Domain_", "(_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "if", " ", "site", " ", "exists_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "check", "\\u", "domain", "\\u", "exists_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "site", " ", "{", "0", "}", " ", "doe", "s", " ", "not", " ", "exist", "\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "'/", "etc", "/", "ngin", "x", "/", "sites", "-", "avail", "able", "/{", "0", "}'_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Disa", "ble", " ", "domain", " ", "{", "0", ":", "10", "}", " ", "\\\\", "t", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ",_", "end_", "=_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isfile_", "(_", "'/", "etc", "/", "ngin", "x", "/", "sites", "-", "enable", "d", "/{", "0", "}'_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "debug_", "(_", "self_", ",_", "\"", "Site", " ", "{", "0", "}", " ", "alr", "ead", "y", " ", "disable", "d", "\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "\"[\"_", "+_", "Log_", "._", "FAIL_", "+_", "\"", "Fail", "ed", "\"_", "+_", "Log_", "._", "OK", "BLUE_", "+_", "\"]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "EE", "File", "Utils_", "._", "remove", "\\u", "symlink_", "(_", "self_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "etc", "/", "ngin", "x", "/", "sites", "-", "enable", "d", "/{", "0", "}'_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EE", "Git", "_", "._", "add_", "(_", "self_", ",_", "[_", "\"/", "etc", "/", "ngin", "x", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "=_", "\"", "Disa", "ble", "d", " ", "{", "0", "}", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Site", "Info_", "(_", "self_", ",_", "ee", "\\u", "domain_", ",_", "enabled_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "\"[\"_", "+_", "Log_", "._", "ENDC_", "+_", "\"", "OK", "\"_", "+_", "Log_", "._", "OK", "BLUE_", "+_", "\"]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "EE", "Service_", "._", "relo", "ad", "\\u", "service_", "(_", "self_", ",_", "'", "ngin", "x", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "service", " ", "ngin", "x", " ", "relo", "ad", " ", "fail", "ed", ".", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "check", " ", "issue", "s", " ", "with", " ", "`", "ngin", "x", " ", "-", "t", "`", " ", "command", "\"_", ")_", "\\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 ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "ngin", "x", " ", "configura", "tion", " ", "file", " ", "doe", "s", " ", "not", " ", "exist", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "EE", "Site", "Controller_", "(_", "Ce", "ment", "Base", "Controller_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "expose_", "(_", "help_", "=_", "\"", "Get", " ", "example", ".", "com", " ", "informati", "on", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "info_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "not_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", "=_", "(_", "input_", "(_", "'", "Enter", " ", "site", " ", "name", " ", ":", " ", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "strip_", "(_", ")_", ")_", "\\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 ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "'", "coul", "d", " ", "not", " ", "input", " ", "site", " ", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", "=_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "ee", "\\u", "domain_", ",_", "ee", "\\u", "www", "\\u", "domain_", ")_", "=_", "Validate", "Domain_", "(_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ee", "\\u", "db", "\\u", "name_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ee", "\\u", "db", "\\u", "user_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ee", "\\u", "db", "\\u", "pass_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hh", "vm_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "check", "\\u", "domain", "\\u", "exists_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "site", " ", "{", "0", "}", " ", "doe", "s", " ", "not", " ", "exist", "\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "'/", "etc", "/", "ngin", "x", "/", "sites", "-", "avail", "able", "/{", "0", "}'_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "site", "info_", "=_", "get", "Site", "Info_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "site", "type_", "=_", "site", "info_", "._", "site", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cache", "type_", "=_", "site", "info_", "._", "cache", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ee", "\\u", "site", "\\u", "webr", "oot_", "=_", "site", "info_", "._", "site", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "access", "\\u", "log_", "=_", "(_", "ee", "\\u", "site", "\\u", "webr", "oot_", "+_", "'/", "logs", "/", "access", ".", "log", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error", "\\u", "log_", "=_", "(_", "ee", "\\u", "site", "\\u", "webr", "oot_", "+_", "'/", "logs", "/", "error", ".", "log", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ee", "\\u", "db", "\\u", "name_", "=_", "site", "info_", "._", "db", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ee", "\\u", "db", "\\u", "user_", "=_", "site", "info_", "._", "db", "\\u", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ee", "\\u", "db", "\\u", "pass_", "=_", "site", "info_", "._", "db", "\\u", "password_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ee", "\\u", "db", "\\u", "host_", "=_", "site", "info_", "._", "db", "\\u", "host_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "site", "type_", "!=_", "\"", "html", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hh", "vm_", "=_", "(_", "\"", "enable", "d", "\"_", "if_", "site", "info_", "._", "is", "\\u", "hh", "vm_", "else_", "\"", "disable", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "site", "type_", "==_", "\"", "proxy", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "access", "\\u", "log_", "=_", "\"/", "var", "/", "log", "/", "ngin", "x", "/{", "0", "}.", "access", ".", "log", "\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error", "\\u", "log_", "=_", "\"/", "var", "/", "log", "/", "ngin", "x", "/{", "0", "}.", "error", ".", "log", "\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ee", "\\u", "site", "\\u", "webr", "oot_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "php", "\\u", "version_", "=_", "site", "info_", "._", "php", "\\u", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page", "speed_", "=_", "(_", "\"", "enable", "d", "\"_", "if_", "site", "info_", "._", "is", "\\u", "page", "speed_", "else_", "\"", "disable", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ssl_", "=_", "(_", "\"", "enable", "d", "\"_", "if_", "site", "info_", "._", "is", "\\u", "ssl_", "else_", "\"", "disable", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "ssl_", "==_", "\"", "enable", "d", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ssl", "provider_", "=_", "\"", "Let", "s", " ", "Encrypt", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ssl", "expiry_", "=_", "str_", "(_", "SSL_", "._", "get", "Expir", "ation", "Date_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ssl", "provider_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ssl", "expiry_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "dict_", "(_", "domain_", "=_", "ee", "\\u", "domain_", ",_", "webr", "oot_", "=_", "ee", "\\u", "site", "\\u", "webr", "oot_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "access", "log_", "=_", "access", "\\u", "log_", ",_", "error", "log_", "=_", "error", "\\u", "log_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dbname_", "=_", "ee", "\\u", "db", "\\u", "name_", ",_", "dbus", "er_", "=_", "ee", "\\u", "db", "\\u", "user_", ",_", "php", "\\u", "version_", "=_", "php", "\\u", "version_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dbpa", "ss_", "=_", "ee", "\\u", "db", "\\u", "pass_", ",_", "hh", "vm_", "=_", "hh", "vm_", ",_", "page", "speed_", "=_", "page", "speed_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ssl_", "=_", "ssl_", ",_", "ssl", "provider_", "=_", "ssl", "provider_", ",_", "ssl", "expiry_", "=_", "ssl", "expiry_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "site", "type_", "+_", "\"", " ", "\"_", "+_", "cache", "type_", "+_", "\"", " ", "({", "0", "})\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "\"", "enable", "d", "\"_", "if_", "site", "info_", "._", "is", "\\u", "enabled_", "else_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "disable", "d", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "app_", "._", "render_", "(_", "(_", "data_", ")_", ",_", "'", "site", "info", ".", "must", "ache", "'_", ")_", "\\u\\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_", "._", "error_", "(_", "self_", ",_", "\"", "ngin", "x", " ", "configura", "tion", " ", "file", " ", "doe", "s", " ", "not", " ", "exist", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "EE", "Site", "Controller_", "(_", "Ce", "ment", "Base", "Controller_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "expose_", "(_", "help_", "=_", "\"", "Monitor", " ", "example", ".", "com", " ", "logs", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "log_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", "=_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "ee", "\\u", "domain_", ",_", "ee", "\\u", "www", "\\u", "domain_", ")_", "=_", "Validate", "Domain_", "(_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ee", "\\u", "site", "\\u", "webr", "oot_", "=_", "get", "Site", "Info_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", "._", "site", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "check", "\\u", "domain", "\\u", "exists_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "site", " ", "{", "0", "}", " ", "doe", "s", " ", "not", " ", "exist", "\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logfile", "s_", "=_", "glob_", "._", "glob_", "(_", "ee", "\\u", "site", "\\u", "webr", "oot_", "+_", "'/", "logs", "/*", ".", "log", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "logfile", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log", "watch_", "(_", "self_", ",_", "logfile", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "EE", "Site", "Controller_", "(_", "Ce", "ment", "Base", "Controller_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "expose_", "(_", "help_", "=_", "\"", "Display", " ", "Ng", "inx", " ", "configura", "tion", " ", "of", " ", "example", ".", "com", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "show_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "not_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", "=_", "(_", "input_", "(_", "'", "Enter", " ", "site", " ", "name", " ", ":", " ", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "strip_", "(_", ")_", ")_", "\\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 ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "'", "coul", "d", " ", "not", " ", "input", " ", "site", " ", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", " ", "Write", " ", "code", " ", "for", " ", "ee", " ", "site", " ", "edit", " ", "command", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", "=_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "ee", "\\u", "domain_", ",_", "ee", "\\u", "www", "\\u", "domain_", ")_", "=_", "Validate", "Domain_", "(_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "check", "\\u", "domain", "\\u", "exists_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "site", " ", "{", "0", "}", " ", "doe", "s", " ", "not", " ", "exist", "\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "'/", "etc", "/", "ngin", "x", "/", "sites", "-", "avail", "able", "/{", "0", "}'_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Display", " ", "NG", "IN", "X", " ", "configura", "tion", " ", "for", " ", "{", "0", "}\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "open_", "(_", "'/", "etc", "/", "ngin", "x", "/", "sites", "-", "avail", "able", "/{", "0", "}'_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "encoding_", "=_", "'", "utf", "-", "8", "'_", ",_", "mode_", "=_", "'", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "f_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "ENDC_", "+_", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "ngin", "x", " ", "configura", "tion", " ", "file", " ", "doe", "s", " ", "not", " ", "exist", "s", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "EE", "Site", "Controller_", "(_", "Ce", "ment", "Base", "Controller_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "expose_", "(_", "help_", "=_", "\"", "Change", " ", "director", "y", " ", "to", " ", "site", " ", "webr", "oot", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "cd_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "not_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", "=_", "(_", "input_", "(_", "'", "Enter", " ", "site", " ", "name", " ", ":", " ", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "strip_", "(_", ")_", ")_", "\\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 ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "'", "Una", "ble", " ", "to", " ", "read", " ", "input", ",", " ", "plea", "se", " ", "try", " ", "again", "'_", ")_", "\\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_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", "=_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "ee", "\\u", "domain_", ",_", "ee", "\\u", "www", "\\u", "domain_", ")_", "=_", "Validate", "Domain_", "(_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "check", "\\u", "domain", "\\u", "exists_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "site", " ", "{", "0", "}", " ", "doe", "s", " ", "not", " ", "exist", "\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ee", "\\u", "site", "\\u", "webr", "oot_", "=_", "get", "Site", "Info_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", "._", "site", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EE", "File", "Utils_", "._", "chdir_", "(_", "self_", ",_", "ee", "\\u", "site", "\\u", "webr", "oot_", ")_", "\\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 ", " _", "subprocess_", "._", "call_", "(_", "[_", "'", "bash", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "debug_", "(_", "self_", ",_", "\"{", "0", "}{", "1", "}\"_", "._", "format_", "(_", "e_", "._", "errno_", ",_", "e_", "._", "strerror_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "una", "ble", " ", "to", " ", "change", " ", "director", "y", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "EE", "Site", "Edit", "Controller_", "(_", "Ce", "ment", "Base", "Controller_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "label_", "=_", "'", "edit", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stacked", "\\u", "on_", "=_", "'", "site", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stacked", "\\u", "type_", "=_", "'", "nest", "ed", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "description_", "=_", "(_", "'", "Edit", " ", "Ng", "inx", " ", "configura", "tion", " ", "of", " ", "site", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arguments_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'", "site", "\\u", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "'", "domain", " ", "name", " ", "for", " ", "the", " ", "site", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nargs_", "=_", "'?'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'--", "page", "speed", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "\"", "edit", " ", "page", "speed", " ", "configura", "tion", " ", "for", " ", "site", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "'", "store", "\\u", "true", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "EE", "Site", "Edit", "Controller_", "(_", "Ce", "ment", "Base", "Controller_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "expose_", "(_", "hide_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "default_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "not_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", "=_", "(_", "input_", "(_", "'", "Enter", " ", "site", " ", "name", " ", ":", " ", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "strip_", "(_", ")_", ")_", "\\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 ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "'", "Una", "ble", " ", "to", " ", "read", " ", "input", ",", " ", "Ple", "ase", " ", "try", " ", "again", "'_", ")_", "\\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_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", "=_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "ee", "\\u", "domain_", ",_", "ee", "\\u", "www", "\\u", "domain_", ")_", "=_", "Validate", "Domain_", "(_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "check", "\\u", "domain", "\\u", "exists_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "site", " ", "{", "0", "}", " ", "doe", "s", " ", "not", " ", "exist", "\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ee", "\\u", "site", "\\u", "webr", "oot_", "=_", "EE", "Variables_", "._", "ee", "\\u", "webr", "oot_", "+_", "ee", "\\u", "domain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "self_", "._", "app_", "._", "pargs_", "._", "page", "speed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "'/", "etc", "/", "ngin", "x", "/", "sites", "-", "avail", "able", "/{", "0", "}'_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", ":_", "\\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 ", " ", "_", "EE", "Shel", "l", "Exec_", "._", "invoke", "\\u", "editor_", "(_", "self_", ",_", "'/", "etc", "/", "ngin", "x", "/", "sites", "-", "avail", "a", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ble", "/{", "0", "}'_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Command", "Execut", "ion", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Fail", "ed", " ", "invoke", " ", "editor", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "EE", "Git", "_", "._", "check", "filest", "atus", "_", "(_", "self_", ",_", "\"/", "etc", "/", "ngin", "x", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "etc", "/", "ngin", "x", "/", "sites", "-", "avail", "able", "/{", "0", "}'_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "EE", "Git", "_", "._", "add_", "(_", "self_", ",_", "[_", "\"/", "etc", "/", "ngin", "x", "\"_", "]_", ",_", "msg_", "=_", "\"", "Edit", " ", "webs", "ite", ":", " ", "{", "0", "}\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Relo", "ad", " ", "NG", "IN", "X_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "EE", "Service_", "._", "relo", "ad", "\\u", "service_", "(_", "self_", ",_", "'", "ngin", "x", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "service", " ", "ngin", "x", " ", "relo", "ad", " ", "fail", "ed", ".", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "check", " ", "issue", "s", " ", "with", " ", "`", "ngin", "x", " ", "-", "t", "`", " ", "command", "\"_", ")_", "\\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 ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "ngin", "x", " ", "configura", "tion", " ", "file", " ", "doe", "s", " ", "not", " ", "exist", "s", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\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_", "._", "app_", "._", "pargs_", "._", "page", "speed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "'{", "0", "}/", "conf", "/", "ngin", "x", "/", "page", "speed", ".", "conf", "'_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "ee", "\\u", "site", "\\u", "webr", "oot_", ")_", ")_", ":_", "\\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 ", " ", "_", "EE", "Shel", "l", "Exec_", "._", "invoke", "\\u", "editor_", "(_", "self_", ",_", "'{", "0", "}/", "conf", "/", "ngin", "x", "/'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "page", "speed", ".", "conf", "'_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "ee", "\\u", "site", "\\u", "webr", "oot_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Command", "Execut", "ion", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Fail", "ed", " ", "invoke", " ", "editor", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "EE", "Git", "_", "._", "check", "filest", "atus", "_", "(_", "self_", ",_", "\"{", "0", "}/", "conf", "/", "ngin", "x", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "ee", "\\u", "site", "\\u", "webr", "oot_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'{", "0", "}/", "conf", "/", "ngin", "x", "/", "page", "speed", ".", "conf", "'_", "._", "format_", "(_", "ee", "\\u", "site", "\\u", "webr", "oot_", ")_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "EE", "Git", "_", "._", "add_", "(_", "self_", ",_", "[_", "\"{", "0", "}/", "conf", "/", "ngin", "x", "\"_", "._", "format_", "(_", "ee", "\\u", "site", "\\u", "webr", "oot_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "=_", "\"", "Edit", " ", "Page", "spp", "ed", " ", "config", " ", "of", " ", "site", ":", " ", "{", "0", "}\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Relo", "ad", " ", "NG", "IN", "X_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "EE", "Service_", "._", "relo", "ad", "\\u", "service_", "(_", "self_", ",_", "'", "ngin", "x", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "service", " ", "ngin", "x", " ", "relo", "ad", " ", "fail", "ed", ".", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "check", " ", "issue", "s", " ", "with", " ", "`", "ngin", "x", " ", "-", "t", "`", " ", "command", "\"_", ")_", "\\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 ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Page", "speed", " ", "configura", "tion", " ", "file", " ", "doe", "s", " ", "not", " ", "exist", "s", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "EE", "Site", "Creat", "e", "Controller_", "(_", "Ce", "ment", "Base", "Controller_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "label_", "=_", "'", "create", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stacked", "\\u", "on_", "=_", "'", "site", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stacked", "\\u", "type_", "=_", "'", "nest", "ed", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "description_", "=_", "(_", "'", "this", " ", "command", "s", " ", "set", " ", "up", " ", "configura", "tion", " ", "and", " ", "install", "s", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "require", "d", " ", "files", " ", "as", " ", "options", " ", "are", " ", "provided", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arguments_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'", "site", "\\u", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "'", "domain", " ", "name", " ", "for", " ", "the", " ", "site", " ", "to", " ", "be", " ", "created", ".'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nargs_", "=_", "'?'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'--", "html", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "\"", "create", " ", "html", " ", "site", "\"_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'--", "php", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "\"", "create", " ", "php", " ", "site", "\"_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'--", "php", "7", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "\"", "create", " ", "php", " ", "7.0", " ", "site", "\"_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'--", "mysql", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "\"", "create", " ", "mysql", " ", "site", "\"_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'--", "wp", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "\"", "create", " ", "wordpress", " ", "single", " ", "site", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "'", "store", "\\u", "true", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'--", "wps", "ub", "dir", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "\"", "create", " ", "wordpress", " ", "multisi", "te", " ", "with", " ", "subdirectory", " ", "setup", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "'", "store", "\\u", "true", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'--", "wps", "ub", "domain", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "\"", "create", " ", "wordpress", " ", "multisi", "te", " ", "with", " ", "subdomain", " ", "setup", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "'", "store", "\\u", "true", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'--", "w3", "tc", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "\"", "create", " ", "wordpress", " ", "single", "/", "multi", " ", "site", " ", "with", " ", "w3", "tc", " ", "cache", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "'", "store", "\\u", "true", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'--", "wp", "fc", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "\"", "create", " ", "wordpress", " ", "single", "/", "multi", " ", "site", " ", "with", " ", "wp", "fc", " ", "cache", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "'", "store", "\\u", "true", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'--", "wps", "c", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "\"", "create", " ", "wordpress", " ", "single", "/", "multi", " ", "site", " ", "with", " ", "wps", "c", " ", "cache", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "'", "store", "\\u", "true", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'--", "wp", "redis", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "\"", "create", " ", "wordpress", " ", "single", "/", "multi", " ", "site", " ", "with", " ", "redis", " ", "cache", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "'", "store", "\\u", "true", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'--", "hh", "vm", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "\"", "create", " ", "HH", "VM", " ", "site", "\"_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'--", "page", "speed", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "\"", "create", " ", "page", "speed", " ", "site", "\"_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'-", "le", "'_", ",_", "'--", "lets", "encrypt", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "\"", "configur", "e", " ", "lets", "encrypt", " ", "ssl", " ", "for", " ", "the", " ", "site", "\"_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'--", "user", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "\"", "provide", " ", "user", " ", "for", " ", "wordpress", " ", "site", "\"_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'--", "email", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "\"", "provide", " ", "email", " ", "address", " ", "for", " ", "wordpress", " ", "site", "\"_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'--", "pass", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "\"", "provide", " ", "password", " ", "for", " ", "wordpress", " ", "user", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest_", "=_", "'", "wp", "pass", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'--", "proxy", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "\"", "create", " ", "proxy", " ", "for", " ", "site", "\"_", ",_", "nargs_", "=_", "'+'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'--", "experimental", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "\"", "Enable", " ", "Expe", "rime", "nal", " ", "package", "s", " ", "with", "out", " ", "prompt", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "'", "store", "\\u", "true", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "EE", "Site", "Creat", "e", "Controller_", "(_", "Ce", "ment", "Base", "Controller_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "expose_", "(_", "hide_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "default_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "self", ".", "app", ".", "render", "((", "data", "),", " ", "'", "default", ".", "must", "ache", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "domain", " ", "name", " ", "validation_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", ",_", "port_", "=_", "None_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stype_", ",_", "cache_", "=_", "det", "Site", "Par", "_", "(_", "vars_", "(_", "self_", "._", "app_", "._", "pargs_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Run", "time", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "debug_", "(_", "self_", ",_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Ple", "ase", " ", "provide", " ", "valid", " ", "options", " ", "to", " ", "creati", "ng", " ", "site", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "stype_", "is_", "None_", "and_", "self_", "._", "app_", "._", "pargs_", "._", "proxy_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stype_", ",_", "cache_", "=_", "'", "proxy", "'_", ",_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proxy", "info_", "=_", "self_", "._", "app_", "._", "pargs_", "._", "proxy_", "[_", "0_", "]_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "proxy", "info_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Ple", "ase", " ", "provide", " ", "proxy", " ", "server", " ", "host", " ", "informati", "on", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "proxy", "info_", "=_", "proxy", "info_", "._", "split_", "(_", "':'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "proxy", "info_", "[_", "0_", "]_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "'", "80", "'_", "if_", "len_", "(_", "proxy", "info_", ")_", "<_", "2_", "else_", "proxy", "info_", "[_", "1_", "]_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "stype_", "is_", "None_", "and_", "not_", "self_", "._", "app_", "._", "pargs_", "._", "proxy_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stype_", ",_", "cache_", "=_", "'", "html", "'_", ",_", "'", "basic", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "stype_", "and_", "self_", "._", "app_", "._", "pargs_", "._", "proxy_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "proxy", " ", "shou", "ld", " ", "not", " ", "be", " ", "used", " ", "with", " ", "other", " ", "site", " ", "types", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "app_", "._", "pargs_", "._", "proxy_", "and_", "(_", "self_", "._", "app_", "._", "pargs_", "._", "page", "speed_", "\\u\\u\\uNL\\u\\u\\u_", "or_", "self_", "._", "app_", "._", "pargs_", "._", "hh", "vm_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Pro", "xy", " ", "site", " ", "can", " ", "not", " ", "run", " ", "on", " ", "page", "speed", " ", "or", " ", "hh", "vm", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "not_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "preproc", "essi", "ng", " ", "bef", "ore", " ", "finalize", " ", "site", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", "=_", "(_", "input_", "(_", "'", "Enter", " ", "site", " ", "name", " ", ":", " ", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "strip_", "(_", ")_", ")_", "\\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 ", " _", "Log_", "._", "debug_", "(_", "self_", ",_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Una", "ble", " ", "to", " ", "input", " ", "site", " ", "name", ",", " ", "Ple", "ase", " ", "try", " ", "again", "!\"_", ")_", "\\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_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", "=_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "ee", "\\u", "domain_", ",_", "ee", "\\u", "www", "\\u", "domain_", ")_", "=_", "Validate", "Domain_", "(_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "ee", "\\u", "domain_", "._", "strip_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "error_", "(_", "\"", "Inva", "lid", " ", "domain", " ", "name", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Prov", "ide", " ", "valid", " ", "domain", " ", "name", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ee", "\\u", "site", "\\u", "webr", "oot_", "=_", "EE", "Variables_", "._", "ee", "\\u", "webr", "oot_", "+_", "ee", "\\u", "domain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "check", "\\u", "domain", "\\u", "exists_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "site", " ", "{", "0", "}", " ", "alr", "ead", "y", " ", "exist", "s", "\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "os_", "._", "path_", "._", "isfile_", "(_", "'/", "etc", "/", "ngin", "x", "/", "sites", "-", "avail", "able", "/{", "0", "}'_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Ng", "inx", " ", "configura", "tion", " ", "/", "etc", "/", "ngin", "x", "/", "sites", "-", "avail", "able", "/\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"{", "0", "}", " ", "alr", "ead", "y", " ", "exist", "s", "\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "stype_", "==_", "'", "proxy", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "'", "site", "\\u", "name", "'_", "]_", "=_", "ee", "\\u", "domain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "www", "\\u", "domain", "'_", "]_", "=_", "ee", "\\u", "www", "\\u", "domain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "proxy", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "host", "'_", "]_", "=_", "host_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "port", "'_", "]_", "=_", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ee", "\\u", "site", "\\u", "webr", "oot_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "app_", "._", "pargs_", "._", "php", "7_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "dict_", "(_", "site", "\\u", "name_", "=_", "ee", "\\u", "domain_", ",_", "www", "\\u", "domain_", "=_", "ee", "\\u", "www", "\\u", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "static_", "=_", "False_", ",_", "basic_", "=_", "False_", ",_", "php", "7_", "=_", "True_", ",_", "wp_", "=_", "False_", ",_", "w3", "tc_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wp", "fc_", "=_", "False_", ",_", "wps", "c_", "=_", "False_", ",_", "multisi", "te_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wps", "ub", "dir_", "=_", "False_", ",_", "webr", "oot_", "=_", "ee", "\\u", "site", "\\u", "webr", "oot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "basic", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "stype_", "in_", "[_", "'", "html", "'_", ",_", "'", "php", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "dict_", "(_", "site", "\\u", "name_", "=_", "ee", "\\u", "domain_", ",_", "www", "\\u", "domain_", "=_", "ee", "\\u", "www", "\\u", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "static_", "=_", "True_", ",_", "basic_", "=_", "False_", ",_", "php", "7_", "=_", "False_", ",_", "wp_", "=_", "False_", ",_", "w3", "tc_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wp", "fc_", "=_", "False_", ",_", "wps", "c_", "=_", "False_", ",_", "multisi", "te_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wps", "ub", "dir_", "=_", "False_", ",_", "webr", "oot_", "=_", "ee", "\\u", "site", "\\u", "webr", "oot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "stype_", "==_", "'", "php", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "'", "static", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "basic", "'_", "]_", "=_", "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_", "elif_", "stype_", "in_", "[_", "'", "mysql", "'_", ",_", "'", "wp", "'_", ",_", "'", "wps", "ub", "dir", "'_", ",_", "'", "wps", "ub", "domain", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "dict_", "(_", "site", "\\u", "name_", "=_", "ee", "\\u", "domain_", ",_", "www", "\\u", "domain_", "=_", "ee", "\\u", "www", "\\u", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "static_", "=_", "False_", ",_", "basic_", "=_", "True_", ",_", "wp_", "=_", "False_", ",_", "w3", "tc_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wp", "fc_", "=_", "False_", ",_", "wps", "c_", "=_", "False_", ",_", "wp", "redis_", "=_", "False_", ",_", "multisi", "te_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wps", "ub", "dir_", "=_", "False_", ",_", "webr", "oot_", "=_", "ee", "\\u", "site", "\\u", "webr", "oot_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ee", "\\u", "db", "\\u", "name_", "=_", "''_", ",_", "ee", "\\u", "db", "\\u", "user_", "=_", "''_", ",_", "ee", "\\u", "db", "\\u", "pass_", "=_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ee", "\\u", "db", "\\u", "host_", "=_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "stype_", "in_", "[_", "'", "wp", "'_", ",_", "'", "wps", "ub", "dir", "'_", ",_", "'", "wps", "ub", "domain", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "'", "wp", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "basic", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "cache_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "wp", "-", "user", "'_", "]_", "=_", "self_", "._", "app_", "._", "pargs_", "._", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "wp", "-", "email", "'_", "]_", "=_", "self_", "._", "app_", "._", "pargs_", "._", "email_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "wp", "-", "pass", "'_", "]_", "=_", "self_", "._", "app_", "._", "pargs_", "._", "wp", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "stype_", "in_", "[_", "'", "wps", "ub", "dir", "'_", ",_", "'", "wps", "ub", "domain", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "data_", "[_", "'", "multisi", "te", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "stype_", "==_", "'", "wps", "ub", "dir", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "data_", "[_", "'", "wps", "ub", "dir", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "stype_", "==_", "\"", "html", "\"_", "and_", "self_", "._", "app_", "._", "pargs_", "._", "hh", "vm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Can", " ", "not", " ", "create", " ", "HTM", "L", " ", "site", " ", "with", " ", "HH", "VM", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "data_", "and_", "self_", "._", "app_", "._", "pargs_", "._", "php", "7_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "not_", "self_", "._", "app_", "._", "pargs_", "._", "experimental_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "PH", "P", "7.0", " ", "is", " ", "experimental", " ", "feature", " ", "and", " ", "it", " ", "may", " ", "not", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "work", " ", "with", " ", "all", " ", "CS", "S", "/", "JS", "/", "Cache", " ", "of", " ", "your", " ", "site", ".\\\\", "n", "Do", " ", "you", " ", "wish", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "to", " ", "install", " ", "PH", "P", " ", "7.0", " ", "now", " ", "for", " ", "{", "0", "}?", "\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "prompt_", "\\u\\u\\uNL\\u\\u\\u_", "check", "\\u", "prompt_", "=_", "input_", "(_", "\"", "Type", " ", "\\\\\"", "y", "\\\\\"", " ", "to", " ", "continue", " ", "[", "n", "]:", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "check", "\\u", "prompt_", "!=_", "\"", "Y", "\"_", "and_", "check", "\\u", "prompt_", "!=_", "\"", "y", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Not", " ", "usi", "ng", " ", "PH", "P", " ", "7.0", " ", "for", " ", "site", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "php", "7", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "basic", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "php", "7_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "app_", "._", "pargs_", "._", "php", "7_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "data_", "[_", "'", "php", "7", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "php", "7_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "'", "php", "7", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "php", "7_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "'", "php", "7", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "php", "7_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "not_", "self_", "._", "app_", "._", "pargs_", "._", "w3", "tc_", ")_", "and_", "(_", "not_", "self_", "._", "app_", "._", "pargs_", "._", "wp", "fc_", ")_", "and_", "(_", "not_", "self_", "._", "app_", "._", "pargs_", "._", "wps", "c_", ")_", "and_", "(_", "not_", "self_", "._", "app_", "._", "pargs_", "._", "wp", "redis_", ")_", "and_", "(_", "not_", "self_", "._", "app_", "._", "pargs_", "._", "hh", "vm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "'", "basic", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "for", " ", "debug", " ", "purpose", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "for", " ", "key", ",", " ", "value", " ", "in", " ", "data", ".", "items", "()", " ", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "print", " ", "(", "key", ",", " ", "value", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "data_", "and_", "self_", "._", "app_", "._", "pargs_", "._", "hh", "vm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "not_", "self_", "._", "app_", "._", "pargs_", "._", "experimental_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "HH", "VM", " ", "is", " ", "experimental", " ", "feature", " ", "and", " ", "it", " ", "may", " ", "not", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "work", " ", "with", " ", "all", " ", "plugin", "s", " ", "of", " ", "your", " ", "site", ".\\\\", "n", "You", " ", "can", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "disable", " ", "it", " ", "by", " ", "passi", "ng", " ", "--", "hh", "vm", "=", "off", " ", "late", "r", ".\\\\", "n", "Do", " ", "you", " ", "wish", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "to", " ", "enable", " ", "HH", "VM", " ", "now", " ", "for", " ", "{", "0", "}?", "\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "prompt_", "\\u\\u\\uNL\\u\\u\\u_", "check", "\\u", "prompt_", "=_", "input_", "(_", "\"", "Type", " ", "\\\\\"", "y", "\\\\\"", " ", "to", " ", "continue", " ", "[", "n", "]:", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "check", "\\u", "prompt_", "!=_", "\"", "Y", "\"_", "and_", "check", "\\u", "prompt_", "!=_", "\"", "y", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Not", " ", "usi", "ng", " ", "HH", "VM", " ", "for", " ", "site", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "hh", "vm", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hh", "vm_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "app_", "._", "pargs_", "._", "hh", "vm_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "data_", "[_", "'", "hh", "vm", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hh", "vm_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "'", "hh", "vm", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hh", "vm_", "=_", "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_", "elif_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "'", "hh", "vm", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hh", "vm_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "data_", "and_", "self_", "._", "app_", "._", "pargs_", "._", "page", "speed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "not_", "self_", "._", "app_", "._", "pargs_", "._", "experimental_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Page", "Spee", "d", " ", "is", " ", "experimental", " ", "feature", " ", "and", " ", "it", " ", "may", " ", "not", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "work", " ", "with", " ", "all", " ", "CS", "S", "/", "JS", "/", "Cache", " ", "of", " ", "your", " ", "site", ".\\\\", "n", "You", " ", "can", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "disable", " ", "it", " ", "by", " ", "passi", "ng", " ", "--", "page", "speed", "=", "off", " ", "late", "r", ".\\\\", "n", "Do", " ", "you", " ", "wish", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "to", " ", "enable", " ", "Page", "Spee", "d", " ", "now", " ", "for", " ", "{", "0", "}?", "\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "prompt_", "\\u\\u\\uNL\\u\\u\\u_", "check", "\\u", "prompt_", "=_", "input_", "(_", "\"", "Type", " ", "\\\\\"", "y", "\\\\\"", " ", "to", " ", "continue", " ", "[", "n", "]:", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "check", "\\u", "prompt_", "!=_", "\"", "Y", "\"_", "and_", "check", "\\u", "prompt_", "!=_", "\"", "y", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Not", " ", "usi", "ng", " ", "Page", "Spee", "d", " ", "for", " ", "site", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "page", "speed", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page", "speed_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "app_", "._", "pargs_", "._", "page", "speed_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "data_", "[_", "'", "page", "speed", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page", "speed_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "'", "page", "speed", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page", "speed_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "'", "page", "speed", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page", "speed_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "cache_", "==_", "'", "wp", "redis", "'_", "and_", "(_", "not_", "self_", "._", "app_", "._", "pargs_", "._", "experimental_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Red", "is", " ", "is", " ", "experimental", " ", "feature", " ", "and", " ", "it", " ", "may", " ", "not", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "work", " ", "with", " ", "all", " ", "CS", "S", "/", "JS", "/", "Cache", " ", "of", " ", "your", " ", "site", ".\\\\", "n", "You", " ", "can", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "disable", " ", "it", " ", "by", " ", "chang", "ing", " ", "cache", " ", "late", "r", ".\\\\", "n", "Do", " ", "you", " ", "wish", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "to", " ", "enable", " ", "Red", "is", " ", "now", " ", "for", " ", "{", "0", "}?", "\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "prompt_", "\\u\\u\\uNL\\u\\u\\u_", "check", "\\u", "prompt_", "=_", "input_", "(_", "\"", "Type", " ", "\\\\\"", "y", "\\\\\"", " ", "to", " ", "continue", " ", "[", "n", "]:", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "check", "\\u", "prompt_", "!=_", "\"", "Y", "\"_", "and_", "check", "\\u", "prompt_", "!=_", "\"", "y", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Not", " ", "usi", "ng", " ", "Red", "is", " ", "for", " ", "site", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cache_", "=_", "'", "basic", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "wp", "redis", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "basic", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "app_", "._", "pargs_", "._", "wp", "redis_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", ".", "app", ".", "args", ".", "print", "\\u", "help", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "not", " ", "data", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", ".", "app", ".", "close", "(", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "rer", "equi", "red", " ", "package", "s", " ", "are", " ", "install", "ed", " ", "or", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ee", "\\u", "auth_", "=_", "site", "\\u", "package", "\\u", "check_", "(_", "self_", ",_", "stype_", ")_", "\\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 ", " _", "pre", "\\u", "run", "\\u", "checks_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Site", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "debug_", "(_", "self_", ",_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "NG", "IN", "X", " ", "configura", "tion", " ", "check", " ", "fail", "ed", ".\"_", ")_", "\\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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "setup", " ", "NG", "IN", "X", " ", "configura", "tion", ",", " ", "and", " ", "webr", "oot_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setup", "domain_", "(_", "self_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fix", " ", "Ng", "inx", " ", "Hash", "bucket", " ", "size", " ", "error_", "\\u\\u\\uNL\\u\\u\\u_", "hash", "bucket_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Site", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "call", " ", "clean", "up", " ", "action", "s", " ", "on", " ", "failure_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Oo", "ps", " ", "Some", "thing", " ", "wen", "t", " ", "wrong", " ", "!!\"", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Call", "ing", " ", "clean", "up", " ", "action", "s", " ", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "do", "Clean", "up", "Action_", "(_", "self_", ",_", "domain_", "=_", "ee", "\\u", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "webr", "oot_", "=_", "data_", "[_", "'", "webr", "oot", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "debug_", "(_", "self_", ",_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Check", " ", "logs", " ", "for", " ", "reason", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"`", "tail", " ", "/", "var", "/", "log", "/", "ee", "/", "ee", ".", "log", "`", " ", "&", " ", "Tr", "y", " ", "Again", "!!!", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "proxy", "'_", "in_", "data_", "._", "keys_", "(_", ")_", "and_", "data_", "[_", "'", "proxy", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "add", "New", "Site_", "(_", "self_", ",_", "ee", "\\u", "domain_", ",_", "stype_", ",_", "cache_", ",_", "ee", "\\u", "site", "\\u", "webr", "oot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Service", " ", "Ng", "inx", " ", "Relo", "ad_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "EE", "Service_", "._", "relo", "ad", "\\u", "service_", "(_", "self_", ",_", "'", "ngin", "x", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Oo", "ps", " ", "Some", "thing", " ", "wen", "t", " ", "wrong", " ", "!!\"", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Call", "ing", " ", "clean", "up", " ", "action", "s", " ", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "do", "Clean", "up", "Action_", "(_", "self_", ",_", "domain_", "=_", "ee", "\\u", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delete", "Site", "Info_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "service", " ", "ngin", "x", " ", "relo", "ad", " ", "fail", "ed", ".", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "check", " ", "issue", "s", " ", "with", " ", "`", "ngin", "x", " ", "-", "t", "`", " ", "command", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Check", " ", "logs", " ", "for", " ", "reason", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"`", "tail", " ", "/", "var", "/", "log", "/", "ee", "/", "ee", ".", "log", "`", " ", "&", " ", "Tr", "y", " ", "Again", "!!!", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ee", "\\u", "auth_", "and_", "len_", "(_", "ee", "\\u", "auth_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "msg_", "in_", "ee", "\\u", "auth_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "ENDC_", "+_", "msg_", ",_", "log_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Success", "full", "y", " ", "created", " ", "site", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "http", "://", "{", "0", "}\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Update", " ", "page", "speed", " ", "config_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "app_", "._", "pargs_", "._", "page", "speed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "operate", "On", "Page", "speed_", "(_", "self_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "data_", "[_", "'", "php", "7", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "php", "\\u", "version_", "=_", "\"", "7.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 ", " _", "php", "\\u", "version_", "=_", "\"", "5.6", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "add", "New", "Site_", "(_", "self_", ",_", "ee", "\\u", "domain_", ",_", "stype_", ",_", "cache_", ",_", "ee", "\\u", "site", "\\u", "webr", "oot_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hh", "vm_", "=_", "hh", "vm_", ",_", "page", "speed_", "=_", "page", "speed_", ",_", "php", "\\u", "version_", "=_", "php", "\\u", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", "up", " ", "databa", "se", " ", "for", " ", "My", "SQL", " ", "site_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "ee", "\\u", "db", "\\u", "name", "'_", "in_", "data_", "._", "keys_", "(_", ")_", "and_", "not_", "data_", "[_", "'", "wp", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "data_", "=_", "setup", "database_", "(_", "self_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Add", " ", "databa", "se", " ", "informati", "on", " ", "for", " ", "site", " ", "int", "o", " ", "database_", "\\u\\u\\uNL\\u\\u\\u_", "update", "Site", "Info_", "(_", "self_", ",_", "ee", "\\u", "domain_", ",_", "db", "\\u", "name_", "=_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "db", "\\u", "user_", "=_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "user", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "db", "\\u", "password_", "=_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "pass", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "db", "\\u", "host_", "=_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "host", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Site", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "call", " ", "clean", "up", " ", "action", "s", " ", "on", " ", "failure_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "debug_", "(_", "self_", ",_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Oo", "ps", " ", "Some", "thing", " ", "wen", "t", " ", "wrong", " ", "!!\"", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Call", "ing", " ", "clean", "up", " ", "action", "s", " ", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "do", "Clean", "up", "Action_", "(_", "self_", ",_", "domain_", "=_", "ee", "\\u", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "webr", "oot_", "=_", "data_", "[_", "'", "webr", "oot", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dbname_", "=_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dbus", "er_", "=_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "user", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dbh", "ost_", "=_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "host", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delete", "Site", "Info_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Check", " ", "logs", " ", "for", " ", "reason", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"`", "tail", " ", "/", "var", "/", "log", "/", "ee", "/", "ee", ".", "log", "`", " ", "&", " ", "Tr", "y", " ", "Again", "!!!", "\"_", ")_", "\\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 ", " ", "_", "eed", "bco", "nfig_", "=_", "open_", "(_", "\"{", "0", "}/", "ee", "-", "config", ".", "php", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "ee", "\\u", "site", "\\u", "webr", "oot_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "encoding_", "=_", "'", "utf", "-", "8", "'_", ",_", "mode_", "=_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eed", "bco", "nfig_", "._", "write_", "(_", "\"<", "?", "php", " ", "\\\\", "ndef", "ine", "('", "DB", "\\u", "NAME", "',", " ", "'{", "0", "}')", ";\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"\\\\", "ndef", "ine", "('", "DB", "\\u", "USER", "',", " ", "'{", "1", "}')", ";", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"\\\\", "ndef", "ine", "('", "DB", "\\u", "PASS", "WORD", "',", " ", "'{", "2", "}')", ";\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"\\\\", "ndef", "ine", "('", "DB", "\\u", "HOST", "',", " ", "'{", "3", "}')", ";\\\\", "n", "?>", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "user", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "pass", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "host", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eed", "bco", "nfig_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stype_", "=_", "'", "mysql", "'_", "\\u\\u\\uNEWLINE\\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 ", " ", "_", "Log_", "._", "debug_", "(_", "self_", ",_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "debug_", "(_", "self_", ",_", "\"", "Error", " ", "occure", "d", " ", "whi", "le", " ", "generat", "ing", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ee", "-", "config", ".", "php", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Oo", "ps", " ", "Some", "thing", " ", "wen", "t", " ", "wrong", " ", "!!\"", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Call", "ing", " ", "clean", "up", " ", "action", "s", " ", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "do", "Clean", "up", "Action_", "(_", "self_", ",_", "domain_", "=_", "ee", "\\u", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "webr", "oot_", "=_", "data_", "[_", "'", "webr", "oot", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dbname_", "=_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dbus", "er_", "=_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "user", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dbh", "ost_", "=_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "host", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delete", "Site", "Info_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Check", " ", "logs", " ", "for", " ", "reason", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"`", "tail", " ", "/", "var", "/", "log", "/", "ee", "/", "ee", ".", "log", "`", " ", "&", " ", "Tr", "y", " ", "Again", "!!!", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", "up", " ", "Word", "Press", " ", "if", " ", "Word", "press", " ", "site_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "data_", "[_", "'", "wp", "'_", "]_", ":_", "\\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 ", " ", "_", "ee", "\\u", "wp", "\\u", "creds_", "=_", "setup", "wordpress", "_", "(_", "self_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Add", " ", "databa", "se", " ", "informati", "on", " ", "for", " ", "site", " ", "int", "o", " ", "database_", "\\u\\u\\uNL\\u\\u\\u_", "update", "Site", "Info_", "(_", "self_", ",_", "ee", "\\u", "domain_", ",_", "db", "\\u", "name_", "=_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "db", "\\u", "user_", "=_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "user", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "db", "\\u", "password_", "=_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "pass", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "db", "\\u", "host_", "=_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "host", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Site", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "call", " ", "clean", "up", " ", "action", "s", " ", "on", " ", "failure_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "debug_", "(_", "self_", ",_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Oo", "ps", " ", "Some", "thing", " ", "wen", "t", " ", "wrong", " ", "!!\"", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Call", "ing", " ", "clean", "up", " ", "action", "s", " ", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "do", "Clean", "up", "Action_", "(_", "self_", ",_", "domain_", "=_", "ee", "\\u", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "webr", "oot_", "=_", "data_", "[_", "'", "webr", "oot", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dbname_", "=_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dbus", "er_", "=_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "user", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dbh", "ost_", "=_", "data_", "[_", "'", "ee", "\\u", "mysql", "\\u", "grant", "\\u", "host", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delete", "Site", "Info_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Check", " ", "logs", " ", "for", " ", "reason", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"`", "tail", " ", "/", "var", "/", "log", "/", "ee", "/", "ee", ".", "log", "`", " ", "&", " ", "Tr", "y", " ", "Again", "!!!", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Service", " ", "Ng", "inx", " ", "Relo", "ad", " ", "call", " ", "clean", "up", " ", "if", " ", "fail", "ed", " ", "to", " ", "relo", "ad", " ", "ngin", "x_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "EE", "Service_", "._", "relo", "ad", "\\u", "service_", "(_", "self_", ",_", "'", "ngin", "x", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Oo", "ps", " ", "Some", "thing", " ", "wen", "t", " ", "wrong", " ", "!!\"", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Call", "ing", " ", "clean", "up", " ", "action", "s", " ", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "do", "Clean", "up", "Action_", "(_", "self_", ",_", "domain_", "=_", "ee", "\\u", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "webr", "oot_", "=_", "data_", "[_", "'", "webr", "oot", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "ee", "\\u", "db", "\\u", "name", "'_", "in_", "data_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "do", "Clean", "up", "Action_", "(_", "self_", ",_", "domain_", "=_", "ee", "\\u", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dbname_", "=_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dbus", "er_", "=_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "user", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dbh", "ost_", "=_", "data_", "[_", "'", "ee", "\\u", "mysql", "\\u", "grant", "\\u", "host", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "delete", "Site", "Info_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "service", " ", "ngin", "x", " ", "relo", "ad", " ", "fail", "ed", ".\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "check", " ", "issue", "s", " ", "with", " ", "`", "ngin", "x", " ", "-", "t", "`", " ", "command", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Check", " ", "logs", " ", "for", " ", "reason", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"`", "tail", " ", "/", "var", "/", "log", "/", "ee", "/", "ee", ".", "log", "`", " ", "&", " ", "Tr", "y", " ", "Again", "!!!", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "EE", "Git", "_", "._", "add_", "(_", "self_", ",_", "[_", "\"/", "etc", "/", "ngin", "x", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "=_", "\"{", "0", "}", " ", "created", " ", "with", " ", "{", "1", "}", " ", "{", "2", "}\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "ee", "\\u", "www", "\\u", "domain_", ",_", "stype_", ",_", "cache_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Set", "up", " ", "Permi", "ssion", "s", " ", "for", " ", "webr", "oot_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "set", "webr", "oot", "permissions_", "(_", "self_", ",_", "data_", "[_", "'", "webr", "oot", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Site", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "debug_", "(_", "self_", ",_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Oo", "ps", " ", "Some", "thing", " ", "wen", "t", " ", "wrong", " ", "!!\"", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Call", "ing", " ", "clean", "up", " ", "action", "s", " ", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "do", "Clean", "up", "Action_", "(_", "self_", ",_", "domain_", "=_", "ee", "\\u", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "webr", "oot_", "=_", "data_", "[_", "'", "webr", "oot", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "ee", "\\u", "db", "\\u", "name", "'_", "in_", "data_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "(_", "\"", "Inside", " ", "db", " ", "clean", "up", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "do", "Clean", "up", "Action_", "(_", "self_", ",_", "domain_", "=_", "ee", "\\u", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dbname_", "=_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dbus", "er_", "=_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "user", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dbh", "ost_", "=_", "data_", "[_", "'", "ee", "\\u", "mysql", "\\u", "grant", "\\u", "host", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "delete", "Site", "Info_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Check", " ", "logs", " ", "for", " ", "reason", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"`", "tail", " ", "/", "var", "/", "log", "/", "ee", "/", "ee", ".", "log", "`", " ", "&", " ", "Tr", "y", " ", "Again", "!!!", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ee", "\\u", "auth_", "and_", "len_", "(_", "ee", "\\u", "auth_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "msg_", "in_", "ee", "\\u", "auth_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "ENDC_", "+_", "msg_", ",_", "log_", "=_", "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_", "if_", "data_", "[_", "'", "wp", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "ENDC_", "+_", "\"", "Word", "Press", " ", "admin", " ", "user", " ", ":\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "{", "0", "}\"_", "._", "format_", "(_", "ee", "\\u", "wp", "\\u", "creds_", "[_", "'", "wp", "\\u", "user", "'_", "]_", ")_", ",_", "log_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "ENDC_", "+_", "\"", "Word", "Press", " ", "admin", " ", "user", " ", "password", " ", ":", " ", "{", "0", "}\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "ee", "\\u", "wp", "\\u", "creds_", "[_", "'", "wp", "\\u", "pass", "'_", "]_", ")_", ",_", "log_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "display", "\\u", "cache", "\\u", "settings_", "(_", "self_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Success", "full", "y", " ", "created", " ", "site", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "http", "://", "{", "0", "}\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Site", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Check", " ", "logs", " ", "for", " ", "reason", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"`", "tail", " ", "/", "var", "/", "log", "/", "ee", "/", "ee", ".", "log", "`", " ", "&", " ", "Tr", "y", " ", "Again", "!!!", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "app_", "._", "pargs_", "._", "lets", "encrypt_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "not_", "self_", "._", "app_", "._", "pargs_", "._", "experimental_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "stype_", "in_", "[_", "'", "wps", "ub", "domain", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", " ", " _", "Log_", "._", "warn_", "(_", "self_", ",_", "\"", "Wildcard", " ", "domains", " ", "are", " ", "not", " ", "support", "ed", " ", "in", " ", "Let", "s", " ", "Encrypt", ".\\\\", "n", "WP", " ", "SUB", "DOM", "AIN", " ", "site", " ", "will", " ", "get", " ", "SS", "L", " ", "for", " ", "primary", " ", "site", " ", "only", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Let", "sen", "crypt", " ", "is", " ", "currentl", "y", " ", "in", " ", "beta", " ", "phase", ".\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "\\\\", "n", "Do", " ", "you", " ", "wish", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "to", " ", "enable", " ", "SS", "l", " ", "now", " ", "for", " ", "{", "0", "}?", "\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "prompt_", "\\u\\u\\uNL\\u\\u\\u_", "check", "\\u", "prompt_", "=_", "input_", "(_", "\"", "Type", " ", "\\\\\"", "y", "\\\\\"", " ", "to", " ", "continue", " ", "[", "n", "]:", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "check", "\\u", "prompt_", "!=_", "\"", "Y", "\"_", "and_", "check", "\\u", "prompt_", "!=_", "\"", "y", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "data_", "[_", "'", "lets", "encrypt", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lets", "encrypt_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "data_", "[_", "'", "lets", "encrypt", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lets", "encrypt_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "'", "lets", "encrypt", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lets", "encrypt_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "data_", "[_", "'", "lets", "encrypt", "'_", "]_", "is_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setup", "Let", "s", "Encrypt", "_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "https", "Redirect_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Creat", "ing", " ", "Cro", "n", " ", "Jo", "b", " ", "for", " ", "cert", " ", "auto", "-", "renew", "al", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EE", "Cro", "n_", "._", "setc", "ron", "\\u", "week", "ly_", "(_", "self_", ",_", "'", "ee", " ", "site", " ", "update", " ", "--", "le", "=", "renew", " ", "--", "all", " ", "2", ">", " ", "/", "dev", "/", "null", "'_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ",_", "'", "Ren", "ew", " ", "all", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "lets", "encrypt", " ", "SS", "L", " ", "cert", ".", " ", "Set", " ", "by", " ", "Eas", "y", "Engine", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "EE", "Service_", "._", "relo", "ad", "\\u", "service_", "(_", "self_", ",_", "'", "ngin", "x", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "service", " ", "ngin", "x", " ", "relo", "ad", " ", "fail", "ed", ".", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "check", " ", "issue", "s", " ", "with", " ", "`", "ngin", "x", " ", "-", "t", "`", " ", "command", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Cong", "rat", "ulation", "s", "!", " ", "Success", "full", "y", " ", "Configure", "d", " ", "SS", "l", " ", "for", " ", "Site", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "https", "://", "{", "0", "}\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "SSL_", "._", "get", "Expir", "ation", "Days_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", ">_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "You", "r", " ", "cert", " ", "will", " ", "expir", "e", " ", "within", " ", "\"_", "+_", "str_", "(_", "SSL_", "._", "get", "Expir", "ation", "Days_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", ")_", "+_", "\"", " ", "day", "s", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "warn_", "(_", "self_", ",_", "\"", "You", "r", " ", "cert", " ", "alr", "ead", "y", " ", "EXPIRE", "D", " ", "!", " ", ".", "PLE", "AS", "E", " ", "renew", " ", "soo", "n", " ", ".", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "ngin", "x", " ", "conf", " ", "folder", " ", "int", "o", " ", "GIT", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "EE", "Git", "_", "._", "add_", "(_", "self_", ",_", "[_", "\"{", "0", "}/", "conf", "/", "ngin", "x", "\"_", "._", "format_", "(_", "ee", "\\u", "site", "\\u", "webr", "oot_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "=_", "\"", "Add", "ing", " ", "lets", "encrypt", "s", " ", "config", " ", "of", " ", "site", ":", " ", "{", "0", "}\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Site", "Info_", "(_", "self_", ",_", "ee", "\\u", "domain_", ",_", "ssl_", "=_", "lets", "encrypt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "data_", "[_", "'", "lets", "encrypt", "'_", "]_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Not", " ", "usi", "ng", " ", "Let", "\\\\'", "s", " ", "encrypt", " ", "for", " ", "Site", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "http", "://", "{", "0", "}\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "EE", "Site", "Update", "Controller_", "(_", "Ce", "ment", "Base", "Controller_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "label_", "=_", "'", "update", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stacked", "\\u", "on_", "=_", "'", "site", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stacked", "\\u", "type_", "=_", "'", "nest", "ed", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "description_", "=_", "(_", "'", "Thi", "s", " ", "command", " ", "update", "s", " ", "webs", "ites", " ", "configura", "tion", " ", "to", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "anot", "her", " ", "as", " ", "per", " ", "the", " ", "options", " ", "are", " ", "provided", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arguments_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'", "site", "\\u", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "'", "domain", " ", "name", " ", "for", " ", "the", " ", "site", " ", "to", " ", "be", " ", "update", "d", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nargs_", "=_", "'?'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'--", "password", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "\"", "update", " ", "to", " ", "password", " ", "for", " ", "wordpress", " ", "site", " ", "user", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "'", "store", "\\u", "true", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'--", "html", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "\"", "update", " ", "to", " ", "html", " ", "site", "\"_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'--", "php", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "\"", "update", " ", "to", " ", "php", " ", "site", "\"_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'--", "php", "7", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "\"", "update", " ", "to", " ", "php", "7", " ", "site", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "'", "store", "'_", "or_", "'", "store", "\\u", "const", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "choices_", "=_", "(_", "'", "on", "'_", ",_", "'", "off", "'_", ")_", ",_", "const_", "=_", "'", "on", "'_", ",_", "nargs_", "=_", "'?'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'--", "mysql", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "\"", "update", " ", "to", " ", "mysql", " ", "site", "\"_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'--", "wp", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "\"", "update", " ", "to", " ", "wordpress", " ", "single", " ", "site", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "'", "store", "\\u", "true", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'--", "wps", "ub", "dir", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "\"", "update", " ", "to", " ", "wps", "ub", "dir", " ", "site", "\"_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'--", "wps", "ub", "domain", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "\"", "update", " ", "to", " ", " ", "wps", "ub", "domain", " ", "site", "\"_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'--", "w3", "tc", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "\"", "update", " ", "to", " ", "w3", "tc", " ", "cache", "\"_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'--", "wp", "fc", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "\"", "update", " ", "to", " ", "wp", "fc", " ", "cache", "\"_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'--", "wps", "c", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "\"", "update", " ", "to", " ", "wps", "c", " ", "cache", "\"_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'--", "wp", "redis", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "\"", "update", " ", "to", " ", "redis", " ", "cache", "\"_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'--", "hh", "vm", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "'", "Us", "e", " ", "HH", "VM", " ", "for", " ", "site", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "'", "store", "'_", "or_", "'", "store", "\\u", "const", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "choices_", "=_", "(_", "'", "on", "'_", ",_", "'", "off", "'_", ")_", ",_", "const_", "=_", "'", "on", "'_", ",_", "nargs_", "=_", "'?'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'--", "page", "speed", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "'", "Us", "e", " ", "Page", "Spee", "d", " ", "for", " ", "site", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "'", "store", "'_", "or_", "'", "store", "\\u", "const", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "choices_", "=_", "(_", "'", "on", "'_", ",_", "'", "off", "'_", ")_", ",_", "const_", "=_", "'", "on", "'_", ",_", "nargs_", "=_", "'?'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'-", "le", "'_", ",_", "'--", "lets", "encrypt", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "\"", "configur", "e", " ", "lets", "encrypt", " ", "ssl", " ", "for", " ", "the", " ", "site", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "'", "store", "'_", "or_", "'", "store", "\\u", "const", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "choices_", "=_", "(_", "'", "on", "'_", ",_", "'", "off", "'_", ",_", "'", "renew", "'_", ")_", ",_", "const_", "=_", "'", "on", "'_", ",_", "nargs_", "=_", "'?'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'--", "proxy", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "\"", "update", " ", "to", " ", "proxy", " ", "site", "\"_", ",_", "nargs_", "=_", "'+'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'--", "experimental", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "\"", "Enable", " ", "Expe", "rime", "nal", " ", "package", "s", " ", "with", "out", " ", "prompt", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "'", "store", "\\u", "true", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'--", "all", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "\"", "update", " ", "all", " ", "sites", "\"_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\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_", "EE", "Site", "Update", "Controller_", "(_", "Ce", "ment", "Base", "Controller_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "expose_", "(_", "help_", "=_", "\"", "Update", " ", "site", " ", "type", " ", "or", " ", "cache", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "default_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pargs_", "=_", "self_", "._", "app_", "._", "pargs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "pargs_", "._", "all_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "pargs_", "._", "site", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"`", "--", "all", "`", " ", "option", " ", "cann", "ot", " ", "be", " ", "used", " ", "with", " ", "site", " ", "name", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "provided", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "pargs_", "._", "html_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "No", " ", "site", " ", "can", " ", "be", " ", "update", "d", " ", "to", " ", "html", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "(_", "pargs_", "._", "php", "_", "or_", "pargs_", "._", "php", "7_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "pargs_", "._", "mysql_", "or_", "pargs_", "._", "wp_", "or_", "pargs_", "._", "wps", "ub", "dir_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "pargs_", "._", "wps", "ub", "domain_", "or_", "pargs_", "._", "w3", "tc_", "or_", "pargs_", "._", "wp", "fc_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "pargs_", "._", "wps", "c_", "or_", "pargs_", "._", "hh", "vm_", "or_", "pargs_", "._", "page", "speed_", "or_", "pargs_", "._", "wp", "redis_", "or_", "pargs_", "._", "lets", "encrypt_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Ple", "ase", " ", "provide", " ", "options", " ", "to", " ", "update", " ", "sites", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "pargs_", "._", "all_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "pargs_", "._", "site", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"`", "--", "all", "`", " ", "option", " ", "cann", "ot", " ", "be", " ", "used", " ", "with", " ", "site", " ", "name", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "provided", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sites_", "=_", "get", "All", "sites_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "sites_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "site_", "in_", "sites_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pargs_", "._", "site", "\\u", "name_", "=_", "site_", "._", "site", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "ENDC_", "+_", "Log_", "._", "BOLD_", "+_", "\"", "Up", "dati", "ng", " ", "site", " ", "{", "0", "},\"", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "plea", "se", " ", "wait", "...\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "pargs_", "._", "site", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dou", "pdat", "esi", "te_", "(_", "pargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "dou", "pdat", "esi", "te_", "(_", "pargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "EE", "Site", "Update", "Controller_", "(_", "Ce", "ment", "Base", "Controller_", ")_", ":_", "\\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_", "dou", "pdat", "esi", "te_", "(_", "self_", ",_", "pargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hh", "vm_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page", "speed_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lets", "encrypt_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "php", "7_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stype_", ",_", "cache_", "=_", "det", "Site", "Par", "_", "(_", "vars_", "(_", "pargs_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Run", "time", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "debug_", "(_", "self_", ",_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Ple", "ase", " ", "provide", " ", "valid", " ", "options", " ", "combinat", "ion", " ", "for", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "site", " ", "update", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "stype_", "is_", "None_", "and_", "pargs_", "._", "proxy_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stype_", ",_", "cache_", "=_", "'", "proxy", "'_", ",_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proxy", "info_", "=_", "pargs_", "._", "proxy_", "[_", "0_", "]_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "proxy", "info_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Ple", "ase", " ", "provide", " ", "proxy", " ", "server", " ", "host", " ", "informati", "on", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "proxy", "info_", "=_", "proxy", "info_", "._", "split_", "(_", "':'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "proxy", "info_", "[_", "0_", "]_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "'", "80", "'_", "if_", "len_", "(_", "proxy", "info_", ")_", "<_", "2_", "else_", "proxy", "info_", "[_", "1_", "]_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "stype_", "is_", "None_", "and_", "not_", "(_", "pargs_", "._", "proxy_", "or_", "pargs_", "._", "lets", "encrypt_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stype_", ",_", "cache_", "=_", "'", "html", "'_", ",_", "'", "basic", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "stype_", "and_", "pargs_", "._", "proxy_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"--", "proxy", " ", "can", " ", "not", " ", "be", " ", "used", " ", "with", " ", "other", " ", "site", " ", "types", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "pargs_", "._", "proxy_", "and_", "(_", "pargs_", "._", "page", "speed_", "or_", "pargs_", "._", "hh", "vm_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Pro", "xy", " ", "site", " ", "can", " ", "not", " ", "run", " ", "on", " ", "page", "speed", " ", "or", " ", "hh", "vm", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "pargs_", "._", "site", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "not_", "pargs_", "._", "site", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pargs_", "._", "site", "\\u", "name_", "=_", "(_", "input_", "(_", "'", "Enter", " ", "site", " ", "name", " ", ":", " ", "'_", ")_", "._", "strip_", "(_", ")_", ")_", "\\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 ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "'", "Una", "ble", " ", "to", " ", "input", " ", "site", " ", "name", ",", " ", "Ple", "ase", " ", "try", " ", "again", "!'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pargs_", "._", "site", "\\u", "name_", "=_", "pargs_", "._", "site", "\\u", "name_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "ee", "\\u", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ee", "\\u", "www", "\\u", "domain_", ",_", ")_", "=_", "Validate", "Domain_", "(_", "pargs_", "._", "site", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ee", "\\u", "site", "\\u", "webr", "oot_", "=_", "EE", "Variables_", "._", "ee", "\\u", "webr", "oot_", "+_", "ee", "\\u", "domain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "check", "\\u", "site_", "=_", "get", "Site", "Info_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "check", "\\u", "site_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", " ", "Site", " ", "{", "0", "}", " ", "doe", "s", " ", "not", " ", "exist", ".\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "olds", "ite", "type_", "=_", "check", "\\u", "site_", "._", "site", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oldc", "ache", "type_", "=_", "check", "\\u", "site_", "._", "cache", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "hh", "vm_", "=_", "check", "\\u", "site_", "._", "is", "\\u", "hh", "vm_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "page", "speed_", "=_", "check", "\\u", "site_", "._", "is", "\\u", "page", "speed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check", "\\u", "ssl_", "=_", "check", "\\u", "site_", "._", "is", "\\u", "ssl_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check", "\\u", "php", "\\u", "version_", "=_", "check", "\\u", "site_", "._", "php", "\\u", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "check", "\\u", "php", "\\u", "version_", "==_", "\"", "7.0", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "\\u", "php", "7_", "=_", "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 ", " _", "old", "\\u", "php", "7_", "=_", "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_", "if_", "(_", "pargs_", "._", "password_", "and_", "not_", "(_", "pargs_", "._", "html_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "pargs_", "._", "php", "_", "or_", "pargs_", "._", "php", "7_", "or_", "pargs_", "._", "mysql_", "or_", "pargs_", "._", "wp_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "pargs_", "._", "w3", "tc_", "or_", "pargs_", "._", "wp", "fc_", "or_", "pargs_", "._", "wps", "c_", "\\u\\u\\uNL\\u\\u\\u_", "or_", "pargs_", "._", "wps", "ub", "dir_", "or_", "pargs_", "._", "wps", "ub", "domain_", ")_", ")_", ":_", "\\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 ", " _", "update", "wp", "userp", "ass", "word_", "(_", "self_", ",_", "ee", "\\u", "domain_", ",_", "ee", "\\u", "site", "\\u", "webr", "oot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Site", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "debug_", "(_", "self_", ",_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "\"\\\\", "n", "Passw", "ord", " ", "Unc", "hange", "d", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "(_", "stype_", "==_", "\"", "proxy", "\"_", "and_", "stype_", "==_", "olds", "ite", "type_", "and_", "self_", "._", "app_", "._", "pargs_", "._", "hh", "vm_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "or_", "(_", "stype_", "==_", "\"", "proxy", "\"_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "stype_", "==_", "olds", "ite", "type_", "and_", "self_", "._", "app_", "._", "pargs_", "._", "page", "speed_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Can", " ", "not", " ", "update", " ", "proxy", " ", "site", " ", "to", " ", "HH", "VM", " ", "or", " ", "Page", "speed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "stype_", "==_", "\"", "html", "\"_", "and_", "stype_", "==_", "olds", "ite", "type_", "and_", "self_", "._", "app_", "._", "pargs_", "._", "hh", "vm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Can", " ", "not", " ", "update", " ", "HTM", "L", " ", "site", " ", "to", " ", "HH", "VM", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "(_", "stype_", "==_", "'", "php", "'_", "and_", "olds", "ite", "type_", "not_", "in_", "[_", "'", "html", "'_", ",_", "'", "proxy", "'_", ",_", "'", "php", "7", "'_", "]_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "(", "sty", "pe", " ", "==", " ", "'", "php", "7", "'", " ", "and", " ", "olds", "ite", "type", " ", "not", " ", "in", " ", "['", "html", "',", " ", "'", "mysql", "',", " ", "'", "php", "',", " ", "'", "php", "7", "',", " ", "'", "wp", "',", " ", "'", "wps", "ub", "dir", "',", " ", "'", "wps", "ub", "domain", "',", " ", "])", " ", "or_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "stype_", "==_", "'", "mysql", "'_", "and_", "olds", "ite", "type_", "not_", "in_", "[_", "'", "html", "'_", ",_", "'", "php", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "proxy", "'_", ",_", "'", "php", "7", "'_", "]_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "stype_", "==_", "'", "wp", "'_", "and_", "olds", "ite", "type_", "not_", "in_", "[_", "'", "html", "'_", ",_", "'", "php", "'_", ",_", "'", "mysql", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "proxy", "'_", ",_", "'", "wp", "'_", ",_", "'", "php", "7", "'_", "]_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "stype_", "==_", "'", "wps", "ub", "dir", "'_", "and_", "olds", "ite", "type_", "in_", "[_", "'", "wps", "ub", "domain", "'_", "]_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "stype_", "==_", "'", "wps", "ub", "domain", "'_", "and_", "olds", "ite", "type_", "in_", "[_", "'", "wps", "ub", "dir", "'_", "]_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "stype_", "==_", "olds", "ite", "type_", "and_", "cache_", "==_", "oldc", "ache", "type_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "not_", "(_", "pargs_", "._", "page", "speed_", "or_", "pargs_", "._", "php", "7_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "can", " ", "not", " ", "update", " ", "{", "0", "}", " ", "{", "1", "}", " ", "to", " ", "{", "2", "}", " ", "{", "3", "}\"_", "._", "\\u\\u\\uNL\\u\\u\\u_", "format_", "(_", "olds", "ite", "type_", ",_", "oldc", "ache", "type_", ",_", "stype_", ",_", "cache_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "stype_", "==_", "'", "proxy", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "'", "site", "\\u", "name", "'_", "]_", "=_", "ee", "\\u", "domain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "www", "\\u", "domain", "'_", "]_", "=_", "ee", "\\u", "www", "\\u", "domain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "proxy", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "host", "'_", "]_", "=_", "host_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "port", "'_", "]_", "=_", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page", "speed_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hh", "vm_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "webr", "oot", "'_", "]_", "=_", "ee", "\\u", "site", "\\u", "webr", "oot_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "curr", "site", "type", "'_", "]_", "=_", "olds", "ite", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "curr", "cache", "type", "'_", "]_", "=_", "oldc", "ache", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "stype_", "==_", "'", "php", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "dict_", "(_", "site", "\\u", "name_", "=_", "ee", "\\u", "domain_", ",_", "www", "\\u", "domain_", "=_", "ee", "\\u", "www", "\\u", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "static_", "=_", "False_", ",_", "basic_", "=_", "True_", ",_", "wp_", "=_", "False_", ",_", "w3", "tc_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wp", "fc_", "=_", "False_", ",_", "wps", "c_", "=_", "False_", ",_", "wp", "redis_", "=_", "False_", ",_", "multisi", "te_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wps", "ub", "dir_", "=_", "False_", ",_", "webr", "oot_", "=_", "ee", "\\u", "site", "\\u", "webr", "oot_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "curr", "site", "type_", "=_", "olds", "ite", "type_", ",_", "curr", "cache", "type_", "=_", "oldc", "ache", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "stype_", "in_", "[_", "'", "mysql", "'_", ",_", "'", "wp", "'_", ",_", "'", "wps", "ub", "dir", "'_", ",_", "'", "wps", "ub", "domain", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "dict_", "(_", "site", "\\u", "name_", "=_", "ee", "\\u", "domain_", ",_", "www", "\\u", "domain_", "=_", "ee", "\\u", "www", "\\u", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "static_", "=_", "False_", ",_", "basic_", "=_", "True_", ",_", "wp_", "=_", "False_", ",_", "w3", "tc_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wp", "fc_", "=_", "False_", ",_", "wps", "c_", "=_", "False_", ",_", "wp", "redis_", "=_", "False_", ",_", "multisi", "te_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wps", "ub", "dir_", "=_", "False_", ",_", "webr", "oot_", "=_", "ee", "\\u", "site", "\\u", "webr", "oot_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ee", "\\u", "db", "\\u", "name_", "=_", "''_", ",_", "ee", "\\u", "db", "\\u", "user_", "=_", "''_", ",_", "ee", "\\u", "db", "\\u", "pass_", "=_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ee", "\\u", "db", "\\u", "host_", "=_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "curr", "site", "type_", "=_", "olds", "ite", "type_", ",_", "curr", "cache", "type_", "=_", "oldc", "ache", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "stype_", "in_", "[_", "'", "wp", "'_", ",_", "'", "wps", "ub", "dir", "'_", ",_", "'", "wps", "ub", "domain", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "'", "wp", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "basic", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "cache_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "stype_", "in_", "[_", "'", "wps", "ub", "dir", "'_", ",_", "'", "wps", "ub", "domain", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "data_", "[_", "'", "multisi", "te", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "stype_", "==_", "'", "wps", "ub", "dir", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "data_", "[_", "'", "wps", "ub", "dir", "'_", "]_", "=_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "pargs_", "._", "page", "speed_", "or_", "pargs_", "._", "hh", "vm_", "or_", "pargs_", "._", "php", "7_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "dict_", "(_", "site", "\\u", "name_", "=_", "ee", "\\u", "domain_", ",_", "www", "\\u", "domain_", "=_", "ee", "\\u", "www", "\\u", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "curr", "site", "type_", "=_", "olds", "ite", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "curr", "cache", "type_", "=_", "oldc", "ache", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "webr", "oot_", "=_", "ee", "\\u", "site", "\\u", "webr", "oot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stype_", "=_", "olds", "ite", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cache_", "=_", "oldc", "ache", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "olds", "ite", "type_", "==_", "'", "html", "'_", "or_", "olds", "ite", "type_", "==_", "'", "proxy", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "data_", "[_", "'", "static", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "wp", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "multisi", "te", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "wps", "ub", "dir", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "olds", "ite", "type_", "==_", "'", "php", "'_", "or_", "olds", "ite", "type_", "==_", "'", "mysql", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "data_", "[_", "'", "static", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "wp", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "multisi", "te", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "wps", "ub", "dir", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "olds", "ite", "type_", "==_", "'", "wp", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "data_", "[_", "'", "static", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "wp", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "multisi", "te", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "wps", "ub", "dir", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "olds", "ite", "type_", "==_", "'", "wps", "ub", "dir", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "data_", "[_", "'", "static", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "wp", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "multisi", "te", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "wps", "ub", "dir", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "olds", "ite", "type_", "==_", "'", "wps", "ub", "domain", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "data_", "[_", "'", "static", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "wp", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "multisi", "te", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "wps", "ub", "dir", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "oldc", "ache", "type_", "==_", "'", "basic", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "data_", "[_", "'", "basic", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "w3", "tc", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "wp", "fc", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "wps", "c", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "wp", "redis", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "oldc", "ache", "type_", "==_", "'", "w3", "tc", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "data_", "[_", "'", "basic", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "w3", "tc", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "wp", "fc", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "wps", "c", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "wp", "redis", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "oldc", "ache", "type_", "==_", "'", "wp", "fc", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "data_", "[_", "'", "basic", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "w3", "tc", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "wp", "fc", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "wps", "c", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "wp", "redis", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "oldc", "ache", "type_", "==_", "'", "wps", "c", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "data_", "[_", "'", "basic", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "w3", "tc", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "wp", "fc", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "wps", "c", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "wp", "redis", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "oldc", "ache", "type_", "==_", "'", "wp", "redis", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "data_", "[_", "'", "basic", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "w3", "tc", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "wp", "fc", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "wps", "c", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "wp", "redis", "'_", "]_", "=_", "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_", "if_", "pargs_", "._", "hh", "vm_", "!=_", "'", "off", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "'", "hh", "vm", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hh", "vm_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "pargs_", "._", "hh", "vm_", "==_", "'", "off", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "'", "hh", "vm", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hh", "vm_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "pargs_", "._", "page", "speed_", "!=_", "'", "off", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "'", "page", "speed", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page", "speed_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "pargs_", "._", "page", "speed_", "==_", "'", "off", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "'", "page", "speed", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page", "speed_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "pargs_", "._", "php", "7_", "==_", "'", "on", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "'", "php", "7", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "php", "7_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check", "\\u", "php", "\\u", "version_", "=_", "'", "7.0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "pargs_", "._", "php", "7_", "==_", "'", "off", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "'", "php", "7", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "php", "7_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check", "\\u", "php", "\\u", "version_", "=_", "'", "5.6", "'_", "\\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_", "pargs_", "._", "page", "speed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "page", "speed_", "is_", "old", "\\u", "page", "speed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "page", "speed_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Page", "speed", " ", "is", " ", "alr", "ead", "y", " ", "disable", "d", " ", "for", " ", "give", "n", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "site", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "page", "speed_", "is_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Page", "speed", " ", "is", " ", "alr", "ead", "y", " ", "enable", "d", " ", "for", " ", "give", "n", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "site", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pargs_", "._", "page", "speed_", "=_", "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_", "if_", "pargs_", "._", "php", "7_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "php", "7_", "is_", "old", "\\u", "php", "7_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "php", "7_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "PH", "P", " ", "7.0", " ", "is", " ", "alr", "ead", "y", " ", "disable", "d", " ", "for", " ", "give", "n", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "site", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "php", "7_", "is_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "PH", "P", " ", "7.0", " ", "is", " ", "alr", "ead", "y", " ", "enable", "d", " ", "for", " ", "give", "n", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "site", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pargs_", "._", "php", "7_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "-", "lets", "encrypt", "=", "renew", " ", "code", " ", "go", "es", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "pargs_", "._", "lets", "encrypt_", "==_", "\"", "renew", "\"_", "and_", "not_", "pargs_", "._", "all_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "expir", "y", "\\u", "days_", "=_", "SSL_", "._", "get", "Expir", "ation", "Days_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "\\u", "expir", "y", "\\u", "days_", "=_", "30_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "check", "\\u", "ssl_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "expir", "y", "\\u", "days_", "<=_", "min", "\\u", "expir", "y", "\\u", "days_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "renew", "Let", "s", "Encrypt", "_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", "\\u\\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_", "._", "error_", "(_", "self_", ",_", "\"", "Mor", "e", " ", "than", " ", "30", " ", "day", "s", " ", "left", " ", "for", " ", "certifica", "te", " ", "Expir", "y", ".", " ", "Not", " ", "renew", "ing", " ", "now", ".\"_", ")_", "\\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 ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Cann", "ot", " ", "REN", "EW", " ", "!", " ", "SS", "L", " ", "is", " ", "not", " ", "configur", "ed", " ", "for", " ", "give", "n", " ", "site", " ", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "SUCCESS", ":", " ", "Certificat", "e", " ", "was", " ", "success", "full", "y", " ", "renew", "ed", " ", "For", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "https", "://", "{", "0", "}\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "SSL_", "._", "get", "Expir", "ation", "Days_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", ">_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "You", "r", " ", "cert", " ", "will", " ", "expir", "e", " ", "within", " ", "\"_", "+_", "str_", "(_", "SSL_", "._", "get", "Expir", "ation", "Days_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", ")_", "+_", "\"", " ", "day", "s", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Expir", "ation", " ", "DAT", "E", ":", " ", "\"_", "+_", "str_", "(_", "SSL_", "._", "get", "Expir", "ation", "Date_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "warn_", "(_", "self_", ",_", "\"", "You", "r", " ", "cert", " ", "alr", "ead", "y", " ", "EXPIRE", "D", " ", "!.", " ", "PLE", "AS", "E", " ", "renew", " ", "soo", "n", " ", ".", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "pargs_", "._", "all_", "and_", "pargs_", "._", "lets", "encrypt_", "==_", "\"", "renew", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "check", "\\u", "ssl_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "expir", "y", "\\u", "days_", "=_", "SSL_", "._", "get", "Expir", "ation", "Days_", "(_", "self_", ",_", "ee", "\\u", "domain_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "expir", "y", "\\u", "days_", "<_", "0_", ":_", "\\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_", "min", "\\u", "expir", "y", "\\u", "days_", "=_", "30_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "expir", "y", "\\u", "days_", "<=_", "min", "\\u", "expir", "y", "\\u", "days_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "renew", "Let", "s", "Encrypt", "_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "SUCCESS", ":", " ", "Certificat", "e", " ", "was", " ", "success", "full", "y", " ", "renew", "ed", " ", "For", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "https", "://", "{", "0", "}\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\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_", "(_", "self_", ",_", "\"", "Mor", "e", " ", "than", " ", "60", " ", "day", "s", " ", "left", " ", "for", " ", "certifica", "te", " ", "Expir", "y", ".", " ", "Not", " ", "renew", "ing", " ", "now", ".\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "SSL_", "._", "get", "Expir", "ation", "Days_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", ">_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "You", "r", " ", "cert", " ", "will", " ", "expir", "e", " ", "within", " ", "\"_", "+_", "str_", "(_", "SSL_", "._", "get", "Expir", "ation", "Days_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", ")_", "+_", "\"", " ", "day", "s", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Expir", "ation", " ", "DAT", "E", ":", " ", "\\\\", "n", "\\\\", "n", "\"_", "+_", "str_", "(_", "SSL_", "._", "get", "Expir", "ation", "Date_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "else", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Log", ".", "warn", "(", "self", ",", " ", "\"", "You", "r", " ", "cert", " ", "alr", "ead", "y", " ", "EXPIRE", "D", " ", "!", " ", ".", "PLE", "AS", "E", " ", "renew", " ", "soo", "n", " ", ".", " ", "\")", "_", "\\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 ", " _", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "SS", "L", " ", "not", " ", "configur", "ed", " ", "for", " ", "site", " ", "http", "://", "{", "0", "}\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "pargs_", "._", "all_", "and_", "pargs_", "._", "lets", "encrypt_", "==_", "\"", "off", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "lets", "encrypt_", "is_", "check", "\\u", "ssl_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "lets", "encrypt_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "SS", "l", " ", "is", " ", "not", " ", "configur", "ed", " ", "for", " ", "give", "n", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "site", "\"_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "pargs_", "._", "lets", "encrypt_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "pargs_", "._", "lets", "encrypt_", "==_", "'", "on", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "'", "lets", "encrypt", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lets", "encrypt_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "pargs_", "._", "lets", "encrypt_", "==_", "'", "off", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "'", "lets", "encrypt", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lets", "encrypt_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "lets", "encrypt_", "is_", "check", "\\u", "ssl_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "lets", "encrypt_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "SS", "l", " ", "is", " ", "not", " ", "configur", "ed", " ", "for", " ", "give", "n", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "site", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "lets", "encrypt_", "is_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "SS", "l", " ", "is", " ", "alr", "ead", "y", " ", "configur", "ed", " ", "for", " ", "give", "n", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "site", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pargs_", "._", "lets", "encrypt_", "=_", "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_", "if_", "pargs_", "._", "hh", "vm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hh", "vm_", "is_", "old", "\\u", "hh", "vm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hh", "vm_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "HH", "VM", " ", "is", " ", "allr", "ead", "y", " ", "disable", "d", " ", "for", " ", "give", "n", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "site", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "hh", "vm_", "is_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "HH", "VM", " ", "is", " ", "allr", "ead", "y", " ", "enable", "d", " ", "for", " ", "give", "n", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "site", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pargs_", "._", "hh", "vm_", "=_", "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_", "if_", "data_", "and_", "(_", "not_", "pargs_", "._", "hh", "vm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "old", "\\u", "hh", "vm_", "is_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "'", "hh", "vm", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hh", "vm_", "=_", "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 ", " _", "data_", "[_", "'", "hh", "vm", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hh", "vm_", "=_", "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_", "if_", "data_", "and_", "(_", "not_", "pargs_", "._", "page", "speed_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "old", "\\u", "page", "speed_", "is_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "'", "page", "speed", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page", "speed_", "=_", "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 ", " _", "data_", "[_", "'", "page", "speed", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page", "speed_", "=_", "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_", "if_", "data_", "and_", "(_", "not_", "pargs_", "._", "php", "7_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "old", "\\u", "php", "7_", "is_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "'", "php", "7", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "php", "7_", "=_", "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 ", " _", "data_", "[_", "'", "php", "7", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "php", "7_", "=_", "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_", "if_", "pargs_", "._", "page", "speed_", "==_", "\"", "on", "\"_", "or_", "pargs_", "._", "hh", "vm_", "==_", "\"", "on", "\"_", "or_", "pargs_", "._", "lets", "encrypt_", "==_", "\"", "on", "\"_", "or_", "pargs_", "._", "php", "7_", "==_", "\"", "on", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "pargs_", "._", "php", "7_", "==_", "\"", "on", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "not_", "pargs_", "._", "experimental_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "PH", "P", "7.0", " ", "is", " ", "experimental", " ", "feature", " ", "and", " ", "it", " ", "may", " ", "not", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "work", " ", "with", " ", "all", " ", "plugin", "s", " ", "of", " ", "your", " ", "site", ".\\\\", "n", "You", " ", "can", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "disable", " ", "it", " ", "by", " ", "passi", "ng", " ", "--", "php", "7", "=", "off", " ", "late", "r", ".\\\\", "n", "Do", " ", "you", " ", "wish", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "to", " ", "enable", " ", "PH", "P", " ", "now", " ", "for", " ", "{", "0", "}?", "\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "prompt_", "\\u\\u\\uNL\\u\\u\\u_", "check", "\\u", "prompt_", "=_", "input_", "(_", "\"", "Type", " ", "\\\\\"", "y", "\\\\\"", " ", "to", " ", "continue", " ", "[", "n", "]:", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "check", "\\u", "prompt_", "!=_", "\"", "Y", "\"_", "and_", "check", "\\u", "prompt_", "!=_", "\"", "y", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Not", " ", "usi", "ng", " ", "PH", "P", " ", "7.0", " ", "for", " ", "site", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "php", "7", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "php", "7_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "data_", "[_", "'", "php", "7", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "php", "7_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "data_", "[_", "'", "php", "7", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "php", "7_", "=_", "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_", "if_", "pargs_", "._", "hh", "vm_", "==_", "\"", "on", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "not_", "pargs_", "._", "experimental_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "HH", "VM", " ", "is", " ", "experimental", " ", "feature", " ", "and", " ", "it", " ", "may", " ", "not", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "work", " ", "with", " ", "all", " ", "plugin", "s", " ", "of", " ", "your", " ", "site", ".\\\\", "n", "You", " ", "can", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "disable", " ", "it", " ", "by", " ", "passi", "ng", " ", "--", "hh", "vm", "=", "off", " ", "late", "r", ".\\\\", "n", "Do", " ", "you", " ", "wish", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "to", " ", "enable", " ", "HH", "VM", " ", "now", " ", "for", " ", "{", "0", "}?", "\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "prompt_", "\\u\\u\\uNL\\u\\u\\u_", "check", "\\u", "prompt_", "=_", "input_", "(_", "\"", "Type", " ", "\\\\\"", "y", "\\\\\"", " ", "to", " ", "continue", " ", "[", "n", "]:", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "check", "\\u", "prompt_", "!=_", "\"", "Y", "\"_", "and_", "check", "\\u", "prompt_", "!=_", "\"", "y", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Not", " ", "usi", "ng", " ", "HH", "VM", " ", "for", " ", "site", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "hh", "vm", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hh", "vm_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "data_", "[_", "'", "hh", "vm", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hh", "vm_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "data_", "[_", "'", "hh", "vm", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hh", "vm_", "=_", "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_", "if_", "pargs_", "._", "page", "speed_", "==_", "\"", "on", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "not_", "pargs_", "._", "experimental_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Page", "Spee", "d", " ", "is", " ", "experimental", " ", "feature", " ", "and", " ", "it", " ", "may", " ", "not", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "work", " ", "with", " ", "all", " ", "CS", "S", "/", "JS", "/", "Cache", " ", "of", " ", "your", " ", "site", ".\\\\", "n", "You", " ", "can", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "disable", " ", "it", " ", "by", " ", "passi", "ng", " ", "--", "page", "speed", "=", "off", " ", "late", "r", ".\\\\", "n", "Do", " ", "you", " ", "wish", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "to", " ", "enable", " ", "Page", "Spee", "d", " ", "now", " ", "for", " ", "{", "0", "}?", "\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "prompt_", "\\u\\u\\uNL\\u\\u\\u_", "check", "\\u", "prompt_", "=_", "input_", "(_", "\"", "Type", " ", "\\\\\"", "y", "\\\\\"", " ", "to", " ", "continue", " ", "[", "n", "]:", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "check", "\\u", "prompt_", "!=_", "\"", "Y", "\"_", "and_", "check", "\\u", "prompt_", "!=_", "\"", "y", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Not", " ", "usi", "ng", " ", "Page", "speed", " ", "for", " ", "give", "n", " ", "site", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "page", "speed", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page", "speed_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "data_", "[_", "'", "page", "speed", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page", "speed_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "data_", "[_", "'", "page", "speed", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page", "speed_", "=_", "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_", "if_", "pargs_", "._", "lets", "encrypt_", "==_", "\"", "on", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "not_", "pargs_", "._", "experimental_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "olds", "ite", "type_", "in_", "[_", "'", "wps", "ub", "domain", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", " ", " _", "Log_", "._", "warn_", "(_", "self_", ",_", "\"", "Wildcard", " ", "domains", " ", "are", " ", "not", " ", "support", "ed", " ", "in", " ", "Let", "s", " ", "Encrypt", ".\\\\", "n", "WP", " ", "SUB", "DOM", "AIN", " ", "site", " ", "will", " ", "get", " ", "SS", "L", " ", "for", " ", "primary", " ", "site", " ", "only", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Let", "sen", "crypt", " ", "is", " ", "currentl", "y", " ", "in", " ", "beta", " ", "phase", ".\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "\\\\", "n", "Do", " ", "you", " ", "wish", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "to", " ", "enable", " ", "SS", "l", " ", "now", " ", "for", " ", "{", "0", "}?", "\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "prompt_", "\\u\\u\\uNL\\u\\u\\u_", "check", "\\u", "prompt_", "=_", "input_", "(_", "\"", "Type", " ", "\\\\\"", "y", "\\\\\"", " ", "to", " ", "continue", " ", "[", "n", "]:", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "check", "\\u", "prompt_", "!=_", "\"", "Y", "\"_", "and_", "check", "\\u", "prompt_", "!=_", "\"", "y", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Not", " ", "usi", "ng", " ", "lets", "encrypt", " ", "for", " ", "site", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "lets", "encrypt", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lets", "encrypt_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "data_", "[_", "'", "lets", "encrypt", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lets", "encrypt_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "data_", "[_", "'", "lets", "encrypt", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lets", "encrypt_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "pargs_", "._", "wp", "redis_", "and_", "data_", "[_", "'", "curr", "cache", "type", "'_", "]_", "!=_", "'", "wp", "redis", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "not_", "pargs_", "._", "experimental_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Red", "is", " ", "is", " ", "experimental", " ", "feature", " ", "and", " ", "it", " ", "may", " ", "not", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "work", " ", "with", " ", "all", " ", "plugin", "s", " ", "of", " ", "your", " ", "site", ".\\\\", "n", "You", " ", "can", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "disable", " ", "it", " ", "by", " ", "chang", "ing", " ", "cache", " ", "type", " ", "late", "r", ".\\\\", "n", "Do", " ", "you", " ", "wish", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "to", " ", "enable", " ", "Red", "is", " ", "now", " ", "for", " ", "{", "0", "}?", "\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "prompt_", "\\u\\u\\uNL\\u\\u\\u_", "check", "\\u", "prompt_", "=_", "input_", "(_", "\"", "Type", " ", "\\\\\"", "y", "\\\\\"", " ", "to", " ", "continue", " ", "[", "n", "]:", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "check", "\\u", "prompt_", "!=_", "\"", "Y", "\"_", "and_", "check", "\\u", "prompt_", "!=_", "\"", "y", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Not", " ", "usi", "ng", " ", "Red", "is", " ", "for", " ", "site", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "wp", "redis", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "basic", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cache_", "=_", "'", "basic", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "(_", "hh", "vm_", "is_", "old", "\\u", "hh", "vm_", ")_", "and_", "(_", "page", "speed_", "is_", "old", "\\u", "page", "speed_", ")_", "and_", "(_", "php", "7_", "is_", "old", "\\u", "php", "7_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "stype_", "==_", "olds", "ite", "type_", "and_", "cache_", "==_", "oldc", "ache", "type_", ")_", ")_", ":_", "\\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_", "if_", "not_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Cann", "ot", " ", "update", " ", "{", "0", "},", " ", "Inva", "lid", " ", "Optio", "ns", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ee", "\\u", "auth_", "=_", "site", "\\u", "package", "\\u", "check_", "(_", "self_", ",_", "stype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "name", "'_", "]_", "=_", "check", "\\u", "site_", "._", "db", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "user", "'_", "]_", "=_", "check", "\\u", "site_", "._", "db", "\\u", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "pass", "'_", "]_", "=_", "check", "\\u", "site_", "._", "db", "\\u", "password_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "host", "'_", "]_", "=_", "check", "\\u", "site_", "._", "db", "\\u", "host_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "old", "\\u", "page", "speed", "\\u", "status", "'_", "]_", "=_", "check", "\\u", "site_", "._", "is", "\\u", "page", "speed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "pargs_", "._", "lets", "encrypt_", ":_", "\\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 ", " _", "pre", "\\u", "run", "\\u", "checks_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Site", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "debug_", "(_", "self_", ",_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "NG", "IN", "X", " ", "configura", "tion", " ", "check", " ", "fail", "ed", ".\"_", ")_", "\\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 ", " _", "site", "backup_", "(_", "self_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "debug_", "(_", "self_", ",_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Check", " ", "logs", " ", "for", " ", "reason", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"`", "tail", " ", "/", "var", "/", "log", "/", "ee", "/", "ee", ".", "log", "`", " ", "&", " ", "Tr", "y", " ", "Again", "!!!", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "setup", " ", "NG", "IN", "X", " ", "configura", "tion", ",", " ", "and", " ", "webr", "oot_", "\\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 ", " _", "setup", "domain_", "(_", "self_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Site", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "debug_", "(_", "self_", ",_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Update", " ", "site", " ", "fail", "ed", ".\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Check", " ", "logs", " ", "for", " ", "reason", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"`", "tail", " ", "/", "var", "/", "log", "/", "ee", "/", "ee", ".", "log", "`", " ", "&", " ", "Tr", "y", " ", "Again", "!!!", "\"_", ")_", "\\u\\u\\uNEWLINE\\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_", "if_", "'", "proxy", "'_", "in_", "data_", "._", "keys_", "(_", ")_", "and_", "data_", "[_", "'", "proxy", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "update", "Site", "Info_", "(_", "self_", ",_", "ee", "\\u", "domain_", ",_", "stype_", "=_", "stype_", ",_", "cache_", "=_", "cache_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hh", "vm_", "=_", "hh", "vm_", ",_", "page", "speed_", "=_", "page", "speed_", ",_", "ssl_", "=_", "True_", "if_", "check", "\\u", "site_", "._", "is", "\\u", "ssl_", "else_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Success", "full", "y", " ", "update", "d", " ", "site", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "http", "://", "{", "0", "}\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Update", " ", "page", "speed", " ", "config_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "pargs_", "._", "page", "speed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "operate", "On", "Page", "speed_", "(_", "self_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "pargs_", "._", "lets", "encrypt_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "data_", "[_", "'", "lets", "encrypt", "'_", "]_", "is_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "os_", "._", "path_", "._", "isfile_", "(_", "\"{", "0", "}/", "conf", "/", "ngin", "x", "/", "ssl", ".", "conf", ".", "disable", "d", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "ee", "\\u", "site", "\\u", "webr", "oot_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "setup", "Let", "s", "Encrypt", "_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "EE", "File", "Utils_", "._", "mv", "file_", "(_", "self_", ",_", "\"{", "0", "}/", "conf", "/", "ngin", "x", "/", "ssl", ".", "conf", ".", "disable", "d", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "ee", "\\u", "site", "\\u", "webr", "oot_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'{", "0", "}/", "conf", "/", "ngin", "x", "/", "ssl", ".", "conf", "'_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "ee", "\\u", "site", "\\u", "webr", "oot_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "https", "Redirect_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Creat", "ing", " ", "Cro", "n", " ", "Jo", "b", " ", "for", " ", "cert", " ", "auto", "-", "renew", "al", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EE", "Cro", "n_", "._", "setc", "ron", "\\u", "week", "ly_", "(_", "self_", ",_", "'", "ee", " ", "site", " ", "update", " ", "--", "le", "=", "renew", " ", "--", "all", " ", "2", ">", " ", "/", "dev", "/", "null", "'_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ",_", "'", "Ren", "ew", " ", "all", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "lets", "encrypt", " ", "SS", "L", " ", "cert", ".", " ", "Set", " ", "by", " ", "Eas", "y", "Engine", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "EE", "Service_", "._", "relo", "ad", "\\u", "service_", "(_", "self_", ",_", "'", "ngin", "x", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "service", " ", "ngin", "x", " ", "relo", "ad", " ", "fail", "ed", ".", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "check", " ", "issue", "s", " ", "with", " ", "`", "ngin", "x", " ", "-", "t", "`", " ", "command", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Cong", "rat", "ulation", "s", "!", " ", "Success", "full", "y", " ", "Configure", "d", " ", "SS", "l", " ", "for", " ", "Site", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "https", "://", "{", "0", "}\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "SSL_", "._", "get", "Expir", "ation", "Days_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", ">_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "You", "r", " ", "cert", " ", "will", " ", "expir", "e", " ", "within", " ", "\"_", "+_", "str_", "(_", "SSL_", "._", "get", "Expir", "ation", "Days_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", ")_", "+_", "\"", " ", "day", "s", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "warn_", "(_", "self_", ",_", "\"", "You", "r", " ", "cert", " ", "alr", "ead", "y", " ", "EXPIRE", "D", " ", "!", " ", ".", "PLE", "AS", "E", " ", "renew", " ", "soo", "n", " ", ".", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "data_", "[_", "'", "lets", "encrypt", "'_", "]_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "\"{", "0", "}/", "conf", "/", "ngin", "x", "/", "ssl", ".", "conf", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "ee", "\\u", "site", "\\u", "webr", "oot_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "Log_", "._", "info_", "(_", "self_", ",_", "'", "Sett", "ing", " ", "Ng", "inx", " ", "configura", "tion", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EE", "File", "Utils_", "._", "mv", "file_", "(_", "self_", ",_", "\"{", "0", "}/", "conf", "/", "ngin", "x", "/", "ssl", ".", "conf", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "ee", "\\u", "site", "\\u", "webr", "oot_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'{", "0", "}/", "conf", "/", "ngin", "x", "/", "ssl", ".", "conf", ".", "disable", "d", "'_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "ee", "\\u", "site", "\\u", "webr", "oot_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "https", "Redirect_", "(_", "self_", ",_", "ee", "\\u", "domain_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "EE", "Service_", "._", "relo", "ad", "\\u", "service_", "(_", "self_", ",_", "'", "ngin", "x", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "service", " ", "ngin", "x", " ", "relo", "ad", " ", "fail", "ed", ".", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "check", " ", "issue", "s", " ", "with", " ", "`", "ngin", "x", " ", "-", "t", "`", " ", "command", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Log", ".", "info", "(", "self", ",\"", "Remo", "ving", " ", "Cro", "n", " ", "Jo", "b", " ", "set", " ", "for", " ", "cert", " ", "auto", "-", "renew", "al", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "EE", "Cro", "n", ".", "remove", "\\u", "cron", "(", "self", ",'", "ee", " ", "site", " ", "update", " ", "{", "0", "}", " ", "--", "le", "=", "renew", " ", "--", "min", "\\u", "expir", "y", "\\u", "limit", " ", "30", " ", "2", ">", " ", "\\\\/", "dev", "\\\\/", "null", "'.", "format", "(", "ee", "\\u", "domain", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Success", "full", "y", " ", "Disa", "ble", "d", " ", "SS", "l", " ", "for", " ", "Site", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "http", "://", "{", "0", "}\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "ngin", "x", " ", "conf", " ", "folder", " ", "int", "o", " ", "GIT", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "EE", "Git", "_", "._", "add_", "(_", "self_", ",_", "[_", "\"{", "0", "}/", "conf", "/", "ngin", "x", "\"_", "._", "format_", "(_", "ee", "\\u", "site", "\\u", "webr", "oot_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "=_", "\"", "Add", "ing", " ", "lets", "encrypt", "s", " ", "config", " ", "of", " ", "site", ":", " ", "{", "0", "}\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Site", "Info_", "(_", "self_", ",_", "ee", "\\u", "domain_", ",_", "ssl_", "=_", "lets", "encrypt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "stype_", "==_", "olds", "ite", "type_", "and_", "cache_", "==_", "oldc", "ache", "type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Service", " ", "Ng", "inx", " ", "Relo", "ad_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "EE", "Service_", "._", "relo", "ad", "\\u", "service_", "(_", "self_", ",_", "'", "ngin", "x", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "service", " ", "ngin", "x", " ", "relo", "ad", " ", "fail", "ed", ".", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "check", " ", "issue", "s", " ", "with", " ", "`", "ngin", "x", " ", "-", "t", "`", " ", "command", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "update", "Site", "Info_", "(_", "self_", ",_", "ee", "\\u", "domain_", ",_", "stype_", "=_", "stype_", ",_", "cache_", "=_", "cache_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hh", "vm_", "=_", "hh", "vm_", ",_", "page", "speed_", "=_", "page", "speed_", ",_", "ssl_", "=_", "True_", "if_", "check", "\\u", "site_", "._", "is", "\\u", "ssl_", "else_", "False_", ",_", "php", "\\u", "version_", "=_", "check", "\\u", "php", "\\u", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Success", "full", "y", " ", "update", "d", " ", "site", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "http", "://", "{", "0", "}\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "data", "['", "ee", "\\u", "db", "\\u", "name", "']", " ", "and", " ", "not", " ", "data", "['", "wp", "']", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "ee", "\\u", "db", "\\u", "name", "'_", "in_", "data_", "._", "keys_", "(_", ")_", "and_", "not_", "data_", "[_", "'", "wp", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "setup", "database_", "(_", "self_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Site", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "debug_", "(_", "self_", ",_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Update", " ", "site", " ", "fail", "ed", ".\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Check", " ", "logs", " ", "for", " ", "reason", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"`", "tail", " ", "/", "var", "/", "log", "/", "ee", "/", "ee", ".", "log", "`", " ", "&", " ", "Tr", "y", " ", "Again", "!!!", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "1_", "\\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 ", " _", "eed", "bco", "nfig_", "=_", "open_", "(_", "\"{", "0", "}/", "ee", "-", "config", ".", "php", "\"_", "._", "format_", "(_", "ee", "\\u", "site", "\\u", "webr", "oot_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "encoding_", "=_", "'", "utf", "-", "8", "'_", ",_", "mode_", "=_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eed", "bco", "nfig_", "._", "write_", "(_", "\"<", "?", "php", " ", "\\\\", "ndef", "ine", "('", "DB", "\\u", "NAME", "',", " ", "'{", "0", "}')", ";\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"\\\\", "ndef", "ine", "('", "DB", "\\u", "USER", "',", " ", "'{", "1", "}')", ";", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"\\\\", "ndef", "ine", "('", "DB", "\\u", "PASS", "WORD", "',", " ", "'{", "2", "}')", ";\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"\\\\", "ndef", "ine", "('", "DB", "\\u", "HOST", "',", " ", "'{", "3", "}')", ";\\\\", "n", "?>", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "user", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "pass", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "host", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eed", "bco", "nfig_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\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 ", " _", "Log_", "._", "debug_", "(_", "self_", ",_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "debug_", "(_", "self_", ",_", "\"", "creati", "ng", " ", "ee", "-", "config", ".", "php", " ", "fail", "ed", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Update", " ", "site", " ", "fail", "ed", ".", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Check", " ", "logs", " ", "for", " ", "reason", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"`", "tail", " ", "/", "var", "/", "log", "/", "ee", "/", "ee", ".", "log", "`", " ", "&", " ", "Tr", "y", " ", "Again", "!!!", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", "up", " ", "Word", "Press", " ", "if", " ", "old", " ", "sites", " ", "are", " ", "html", "/", "php", "/", "mysql", " ", "sites_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "data_", "[_", "'", "wp", "'_", "]_", "and_", "olds", "ite", "type_", "in_", "[_", "'", "html", "'_", ",_", "'", "proxy", "'_", ",_", "'", "php", "'_", ",_", "'", "mysql", "'_", "]_", ":_", "\\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 ", " _", "ee", "\\u", "wp", "\\u", "creds_", "=_", "setup", "wordpress", "_", "(_", "self_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Site", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "debug_", "(_", "self_", ",_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Update", " ", "site", " ", "fail", "ed", ".\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Check", " ", "logs", " ", "for", " ", "reason", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"`", "tail", " ", "/", "var", "/", "log", "/", "ee", "/", "ee", ".", "log", "`", " ", "&", " ", "Tr", "y", " ", "Again", "!!!", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Unin", "stall", " ", "unne", "cess", "ary", " ", "plugins_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "olds", "ite", "type_", "in_", "[_", "'", "wp", "'_", ",_", "'", "wps", "ub", "dir", "'_", ",_", "'", "wps", "ub", "domain", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Set", "up", " ", "Word", "Press", " ", "Network", " ", "if", " ", "update", " ", "option", " ", "is", " ", "multisi", "te_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "olds", "ite", " ", "is", " ", "Word", "Press", " ", "single", " ", "site_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "data_", "[_", "'", "multisi", "te", "'_", "]_", "and_", "olds", "ite", "type_", "==_", "'", "wp", "'_", ":_", "\\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 ", " ", "_", "setup", "wordpress", "network_", "(_", "self_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Site", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "debug_", "(_", "self_", ",_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Update", " ", "site", " ", "fail", "ed", ".", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Check", " ", "logs", " ", "for", " ", "reason", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "`", "tail", " ", "/", "var", "/", "log", "/", "ee", "/", "ee", ".", "log", "`", " ", "&", " ", "Tr", "y", " ", "Again", "!!!", "\"_", ")_", "\\u\\u\\uNEWLINE\\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_", "if_", "(_", "oldc", "ache", "type_", "==_", "'", "w3", "tc", "'_", "or_", "oldc", "ache", "type_", "==_", "'", "wp", "fc", "'_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "not_", "(_", "data_", "[_", "'", "w3", "tc", "'_", "]_", "or_", "data_", "[_", "'", "wp", "fc", "'_", "]_", ")_", ")_", ":_", "\\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 ", " ", "_", "uninstall", "wp", "\\u", "plugin_", "(_", "self_", ",_", "'", "w3", "-", "total", "-", "cache", "'_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Site", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "debug_", "(_", "self_", ",_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Update", " ", "site", " ", "fail", "ed", ".", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Check", " ", "logs", " ", "for", " ", "reason", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "`", "tail", " ", "/", "var", "/", "log", "/", "ee", "/", "ee", ".", "log", "`", " ", "&", " ", "Tr", "y", " ", "Again", "!!!", "\"_", ")_", "\\u\\u\\uNEWLINE\\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_", "if_", "(_", "(_", "oldc", "ache", "type_", "in_", "[_", "'", "w3", "tc", "'_", ",_", "'", "wps", "c", "'_", ",_", "'", "basic", "'_", ",_", "'", "wp", "redis", "'_", "]_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "data_", "[_", "'", "wp", "fc", "'_", "]_", ")_", ")_", "or_", "(_", "olds", "ite", "type_", "==_", "'", "wp", "'_", "and_", "data_", "[_", "'", "multisi", "te", "'_", "]_", "and_", "data_", "[_", "'", "wp", "fc", "'_", "]_", ")_", ")_", ":_", "\\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 ", " ", "_", "plugin", "\\u", "data_", "=_", "'{", "\"", "log", "\\u", "level", "\":\"", "INFO", "\",\"", "log", "\\u", "files", "ize", "\":", "5", ",\"", "enable", "\\u", "pur", "ge", "\":", "1", ",\"", "enable", "\\u", "map", "\":", "0", ",\"", "enable", "\\u", "log", "\":", "0", ",\"", "enable", "\\u", "stamp", "\":", "0", ",\"", "pur", "ge", "\\u", "home", "page", "\\u", "on", "\\u", "new", "\":", "1", ",\"", "pur", "ge", "\\u", "home", "page", "\\u", "on", "\\u", "edit", "\":", "1", ",\"", "pur", "ge", "\\u", "home", "page", "\\u", "on", "\\u", "del", "\":", "1", ",\"", "pur", "ge", "\\u", "archive", "\\u", "on", "\\u", "new", "\":", "1", ",\"", "pur", "ge", "\\u", "archive", "\\u", "on", "\\u", "edit", "\":", "0", ",\"", "pur", "ge", "\\u", "archive", "\\u", "on", "\\u", "del", "\":", "0", ",\"", "pur", "ge", "\\u", "archive", "\\u", "on", "\\u", "new", "\\u", "comment", "\":", "0", ",\"", "pur", "ge", "\\u", "archive", "\\u", "on", "\\u", "delete", "d\\u", "comment", "\":", "0", ",\"", "pur", "ge", "\\u", "page", "\\u", "on", "\\u", "mod", "\":", "1", ",\"", "pur", "ge", "\\u", "page", "\\u", "on", "\\u", "new", "\\u", "comment", "\":", "1", ",\"", "pur", "ge", "\\u", "page", "\\u", "on", "\\u", "delete", "d\\u", "comment", "\":", "1", ",\"", "cache", "\\u", "method", "\":\"", "enable", "\\u", "fast", "cgi", "\",\"", "pur", "ge", "\\u", "method", "\":\"", "get", "\\u", "request", "\",\"", "redis", "\\u", "host", "name", "\":\"", "127", ".0", ".0", ".1", "\",\"", "redis", "\\u", "port", "\":\"", "6379", "\",\"", "redis", "\\u", "prefix", "\":\"", "ngin", "x", "-", "cache", ":\"", "}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setup", "wp", "\\u", "plugin_", "(_", "self_", ",_", "'", "ngin", "x", "-", "help", "er", "'_", ",_", "'", "rt", "\\u", "wp", "\\u", "ngin", "x", "\\u", "help", "er", "\\u", "options", "'_", ",_", "plugin", "\\u", "data_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Site", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "debug_", "(_", "self_", ",_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Update", " ", "ngin", "x", "-", "help", "er", " ", "settings", " ", "fail", "ed", ".", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Check", " ", "logs", " ", "for", " ", "reason", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "`", "tail", " ", "/", "var", "/", "log", "/", "ee", "/", "ee", ".", "log", "`", " ", "&", " ", "Tr", "y", " ", "Again", "!!!", "\"_", ")_", "\\u\\u\\uNEWLINE\\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_", "elif_", "(_", "(_", "oldc", "ache", "type_", "in_", "[_", "'", "w3", "tc", "'_", ",_", "'", "wps", "c", "'_", ",_", "'", "basic", "'_", ",_", "'", "wp", "fc", "'_", "]_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "data_", "[_", "'", "wp", "redis", "'_", "]_", ")_", ")_", "or_", "(_", "olds", "ite", "type_", "==_", "'", "wp", "'_", "and_", "data_", "[_", "'", "multisi", "te", "'_", "]_", "and_", "data_", "[_", "'", "wp", "redis", "'_", "]_", ")_", ")_", ":_", "\\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 ", " ", "_", "plugin", "\\u", "data_", "=_", "'{", "\"", "log", "\\u", "level", "\":\"", "INFO", "\",\"", "log", "\\u", "files", "ize", "\":", "5", ",\"", "enable", "\\u", "pur", "ge", "\":", "1", ",\"", "enable", "\\u", "map", "\":", "0", ",\"", "enable", "\\u", "log", "\":", "0", ",\"", "enable", "\\u", "stamp", "\":", "0", ",\"", "pur", "ge", "\\u", "home", "page", "\\u", "on", "\\u", "new", "\":", "1", ",\"", "pur", "ge", "\\u", "home", "page", "\\u", "on", "\\u", "edit", "\":", "1", ",\"", "pur", "ge", "\\u", "home", "page", "\\u", "on", "\\u", "del", "\":", "1", ",\"", "pur", "ge", "\\u", "archive", "\\u", "on", "\\u", "new", "\":", "1", ",\"", "pur", "ge", "\\u", "archive", "\\u", "on", "\\u", "edit", "\":", "0", ",\"", "pur", "ge", "\\u", "archive", "\\u", "on", "\\u", "del", "\":", "0", ",\"", "pur", "ge", "\\u", "archive", "\\u", "on", "\\u", "new", "\\u", "comment", "\":", "0", ",\"", "pur", "ge", "\\u", "archive", "\\u", "on", "\\u", "delete", "d\\u", "comment", "\":", "0", ",\"", "pur", "ge", "\\u", "page", "\\u", "on", "\\u", "mod", "\":", "1", ",\"", "pur", "ge", "\\u", "page", "\\u", "on", "\\u", "new", "\\u", "comment", "\":", "1", ",\"", "pur", "ge", "\\u", "page", "\\u", "on", "\\u", "delete", "d\\u", "comment", "\":", "1", ",\"", "cache", "\\u", "method", "\":\"", "enable", "\\u", "redis", "\",\"", "pur", "ge", "\\u", "method", "\":\"", "get", "\\u", "request", "\",\"", "redis", "\\u", "host", "name", "\":\"", "127", ".0", ".0", ".1", "\",\"", "redis", "\\u", "port", "\":\"", "6379", "\",\"", "redis", "\\u", "prefix", "\":\"", "ngin", "x", "-", "cache", ":\"", "}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setup", "wp", "\\u", "plugin_", "(_", "self_", ",_", "'", "ngin", "x", "-", "help", "er", "'_", ",_", "'", "rt", "\\u", "wp", "\\u", "ngin", "x", "\\u", "help", "er", "\\u", "options", "'_", ",_", "plugin", "\\u", "data_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Site", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "debug_", "(_", "self_", ",_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Update", " ", "ngin", "x", "-", "help", "er", " ", "settings", " ", "fail", "ed", ".", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Check", " ", "logs", " ", "for", " ", "reason", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "`", "tail", " ", "/", "var", "/", "log", "/", "ee", "/", "ee", ".", "log", "`", " ", "&", " ", "Tr", "y", " ", "Again", "!!!", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "plugin", "\\u", "data_", "=_", "'{", "\"", "log", "\\u", "level", "\":\"", "INFO", "\",\"", "log", "\\u", "files", "ize", "\":", "5", ",\"", "enable", "\\u", "pur", "ge", "\":", "0", ",\"", "enable", "\\u", "map", "\":", "0", ",\"", "enable", "\\u", "log", "\":", "0", ",\"", "enable", "\\u", "stamp", "\":", "0", ",\"", "pur", "ge", "\\u", "home", "page", "\\u", "on", "\\u", "new", "\":", "1", ",\"", "pur", "ge", "\\u", "home", "page", "\\u", "on", "\\u", "edit", "\":", "1", ",\"", "pur", "ge", "\\u", "home", "page", "\\u", "on", "\\u", "del", "\":", "1", ",\"", "pur", "ge", "\\u", "archive", "\\u", "on", "\\u", "new", "\":", "1", ",\"", "pur", "ge", "\\u", "archive", "\\u", "on", "\\u", "edit", "\":", "0", ",\"", "pur", "ge", "\\u", "archive", "\\u", "on", "\\u", "del", "\":", "0", ",\"", "pur", "ge", "\\u", "archive", "\\u", "on", "\\u", "new", "\\u", "comment", "\":", "0", ",\"", "pur", "ge", "\\u", "archive", "\\u", "on", "\\u", "delete", "d\\u", "comment", "\":", "0", ",\"", "pur", "ge", "\\u", "page", "\\u", "on", "\\u", "mod", "\":", "1", ",\"", "pur", "ge", "\\u", "page", "\\u", "on", "\\u", "new", "\\u", "comment", "\":", "1", ",\"", "pur", "ge", "\\u", "page", "\\u", "on", "\\u", "delete", "d\\u", "comment", "\":", "1", ",\"", "cache", "\\u", "method", "\":\"", "enable", "\\u", "redis", "\",\"", "pur", "ge", "\\u", "method", "\":\"", "get", "\\u", "request", "\",\"", "redis", "\\u", "host", "name", "\":\"", "127", ".0", ".0", ".1", "\",\"", "redis", "\\u", "port", "\":\"", "6379", "\",\"", "redis", "\\u", "prefix", "\":\"", "ngin", "x", "-", "cache", ":\"", "}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setup", "wp", "\\u", "plugin_", "(_", "self_", ",_", "'", "ngin", "x", "-", "help", "er", "'_", ",_", "'", "rt", "\\u", "wp", "\\u", "ngin", "x", "\\u", "help", "er", "\\u", "options", "'_", ",_", "plugin", "\\u", "data_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Site", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "debug_", "(_", "self_", ",_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Update", " ", "ngin", "x", "-", "help", "er", " ", "settings", " ", "fail", "ed", ".", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Check", " ", "logs", " ", "for", " ", "reason", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "`", "tail", " ", "/", "var", "/", "log", "/", "ee", "/", "ee", ".", "log", "`", " ", "&", " ", "Tr", "y", " ", "Again", "!!!", "\"_", ")_", "\\u\\u\\uNEWLINE\\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_", "if_", "oldc", "ache", "type_", "==_", "'", "wps", "c", "'_", "and_", "not_", "data_", "[_", "'", "wps", "c", "'_", "]_", ":_", "\\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 ", " ", "_", "uninstall", "wp", "\\u", "plugin_", "(_", "self_", ",_", "'", "wp", "-", "super", "-", "cache", "'_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Site", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "debug_", "(_", "self_", ",_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Update", " ", "site", " ", "fail", "ed", ".\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Check", " ", "logs", " ", "for", " ", "reason", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "`", "tail", " ", "/", "var", "/", "log", "/", "ee", "/", "ee", ".", "log", "`", " ", "&", " ", "Tr", "y", " ", "Again", "!!!", "\"_", ")_", "\\u\\u\\uNEWLINE\\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_", "if_", "oldc", "ache", "type_", "==_", "'", "wp", "redis", "'_", "and_", "not_", "data_", "[_", "'", "wp", "redis", "'_", "]_", ":_", "\\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 ", " ", "_", "uninstall", "wp", "\\u", "plugin_", "(_", "self_", ",_", "'", "redis", "-", "cache", "'_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Site", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "debug_", "(_", "self_", ",_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Update", " ", "site", " ", "fail", "ed", ".\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Check", " ", "logs", " ", "for", " ", "reason", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "`", "tail", " ", "/", "var", "/", "log", "/", "ee", "/", "ee", ".", "log", "`", " ", "&", " ", "Tr", "y", " ", "Again", "!!!", "\"_", ")_", "\\u\\u\\uNEWLINE\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "oldc", "ache", "type_", "!=_", "'", "w3", "tc", "'_", "or_", "oldc", "ache", "type_", "!=_", "'", "wp", "fc", "'_", ")_", "and_", "(_", "data_", "[_", "'", "w3", "tc", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "or_", "data_", "[_", "'", "wp", "fc", "'_", "]_", ")_", ":_", "\\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 ", " _", "install", "wp", "\\u", "plugin_", "(_", "self_", ",_", "'", "w3", "-", "total", "-", "cache", "'_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Site", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "debug_", "(_", "self_", ",_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Update", " ", "site", " ", "fail", "ed", ".\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Check", " ", "logs", " ", "for", " ", "reason", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "`", "tail", " ", "/", "var", "/", "log", "/", "ee", "/", "ee", ".", "log", "`", " ", "&", " ", "Tr", "y", " ", "Again", "!!!", "\"_", ")_", "\\u\\u\\uNEWLINE\\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_", "if_", "oldc", "ache", "type_", "!=_", "'", "wps", "c", "'_", "and_", "data_", "[_", "'", "wps", "c", "'_", "]_", ":_", "\\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 ", " _", "install", "wp", "\\u", "plugin_", "(_", "self_", ",_", "'", "wp", "-", "super", "-", "cache", "'_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Site", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "debug_", "(_", "self_", ",_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Update", " ", "site", " ", "fail", "ed", ".\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Check", " ", "logs", " ", "for", " ", "reason", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"`", "tail", " ", "/", "var", "/", "log", "/", "ee", "/", "ee", ".", "log", "`", " ", "&", " ", "Tr", "y", " ", "Again", "!!!", "\"_", ")_", "\\u\\u\\uNEWLINE\\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_", "if_", "oldc", "ache", "type_", "!=_", "'", "wp", "redis", "'_", "and_", "data_", "[_", "'", "wp", "redis", "'_", "]_", ":_", "\\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_", "install", "wp", "\\u", "plugin_", "(_", "self_", ",_", "'", "redis", "-", "cache", "'_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "search", " ", "for", " ", "wp", "-", "config", ".", "php", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "EE", "File", "Utils_", "._", "ise", "xist", "_", "(_", "self_", ",_", "\"{", "0", "}/", "wp", "-", "config", ".", "php", "\"_", "._", "format_", "(_", "ee", "\\u", "site", "\\u", "webr", "oot_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "config", "\\u", "path_", "=_", "'{", "0", "}/", "wp", "-", "config", ".", "php", "'_", "._", "format_", "(_", "ee", "\\u", "site", "\\u", "webr", "oot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "EE", "File", "Utils_", "._", "ise", "xist", "_", "(_", "self_", ",_", "\"{", "0", "}/", "ht", "docs", "/", "wp", "-", "config", ".", "php", "\"_", "._", "format_", "(_", "ee", "\\u", "site", "\\u", "webr", "oot_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "config", "\\u", "path_", "=_", "'{", "0", "}/", "ht", "docs", "/", "wp", "-", "config", ".", "php", "'_", "._", "format_", "(_", "ee", "\\u", "site", "\\u", "webr", "oot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "Log_", "._", "debug_", "(_", "self_", ",_", "\"", "Up", "dati", "ng", " ", "wp", "-", "config", ".", "php", " ", "fail", "ed", ".", " ", "File", " ", "coul", "d", " ", "not", " ", "be", " ", "located", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "wp", "-", "config", ".", "php", " ", "coul", "d", " ", "not", " ", "be", " ", "located", " ", "!!\"", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Site", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "EE", "Shel", "l", "Exec_", "._", "cmd", "\\u", "exec_", "(_", "self_", ",_", "\"", "grep", " ", "-", "q", " ", "\\\\\"", "WP", "\\u", "CACHE", "\\u", "KEY", "\\u", "SAL", "T", "\\\\\"", " ", "{", "0", "}\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "config", "\\u", "path_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "wp", "config_", "=_", "open_", "(_", "\"{", "0", "}\"_", "._", "format_", "(_", "config", "\\u", "path_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "encoding_", "=_", "'", "utf", "-", "8", "'_", ",_", "mode_", "=_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wp", "config_", "._", "write_", "(_", "\"\\\\", "n", "\\\\", "ndef", "ine", "(", " ", "\\\\'", "WP", "\\u", "CACHE", "\\u", "KEY", "\\u", "SAL", "T", "\\\\'", ",", " ", "\\\\'{", "0", "}:", "\\\\'", " ", ");\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wp", "config_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\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 ", " ", " _", "Log_", "._", "debug_", "(_", "self_", ",_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "debug_", "(_", "self_", ",_", "\"", "Up", "dati", "ng", " ", "wp", "-", "config", ".", "php", " ", "fail", "ed", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "warn_", "(_", "self_", ",_", "\"", "Up", "dati", "ng", " ", "wp", "-", "config", ".", "php", " ", "fail", "ed", ".", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Cou", "ld", " ", "not", " ", "append", ":\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"\\\\", "ndef", "ine", "(", " ", "\\\\'", "WP", "\\u", "CACHE", "\\u", "KEY", "\\u", "SAL", "T", "\\\\'", ",", " ", "\\\\'{", "0", "}:", "\\\\'", " ", ");\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"\\\\", "n", "Ple", "ase", " ", "add", " ", "manu", "ally", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Site", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "debug_", "(_", "self_", ",_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Update", " ", "site", " ", "fail", "ed", ".\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Check", " ", "logs", " ", "for", " ", "reason", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"`", "tail", " ", "/", "var", "/", "log", "/", "ee", "/", "ee", ".", "log", "`", " ", "&", " ", "Tr", "y", " ", "Again", "!!!", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Service", " ", "Ng", "inx", " ", "Relo", "ad_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "EE", "Service_", "._", "relo", "ad", "\\u", "service_", "(_", "self_", ",_", "'", "ngin", "x", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "service", " ", "ngin", "x", " ", "relo", "ad", " ", "fail", "ed", ".", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "check", " ", "issue", "s", " ", "with", " ", "`", "ngin", "x", " ", "-", "t", "`", " ", "command", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "EE", "Git", "_", "._", "add_", "(_", "self_", ",_", "[_", "\"/", "etc", "/", "ngin", "x", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "=_", "\"{", "0", "}", " ", "update", "d", " ", "with", " ", "{", "1", "}", " ", "{", "2", "}\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "ee", "\\u", "www", "\\u", "domain_", ",_", "stype_", ",_", "cache_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Set", "up", " ", "Permi", "ssion", "s", " ", "for", " ", "webr", "oot_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "set", "webr", "oot", "permissions_", "(_", "self_", ",_", "data_", "[_", "'", "webr", "oot", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Site", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "debug_", "(_", "self_", ",_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Update", " ", "site", " ", "fail", "ed", ".\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Check", " ", "logs", " ", "for", " ", "reason", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"`", "tail", " ", "/", "var", "/", "log", "/", "ee", "/", "ee", ".", "log", "`", " ", "&", " ", "Tr", "y", " ", "Again", "!!!", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ee", "\\u", "auth_", "and_", "len_", "(_", "ee", "\\u", "auth_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "msg_", "in_", "ee", "\\u", "auth_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "ENDC_", "+_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "display", "\\u", "cache", "\\u", "settings_", "(_", "self_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "data_", "[_", "'", "wp", "'_", "]_", "and_", "olds", "ite", "type_", "in_", "[_", "'", "html", "'_", ",_", "'", "php", "'_", ",_", "'", "mysql", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "info_", "(_", "self_", ",_", "\"\\\\", "n", "\\\\", "n", "\"_", "+_", "Log_", "._", "ENDC_", "+_", "\"", "Word", "Press", " ", "admin", " ", "user", " ", ":\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "{", "0", "}\"_", "._", "format_", "(_", "ee", "\\u", "wp", "\\u", "creds_", "[_", "'", "wp", "\\u", "user", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "ENDC_", "+_", "\"", "Word", "Press", " ", "admin", " ", "password", " ", ":", " ", "{", "0", "}\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "ee", "\\u", "wp", "\\u", "creds_", "[_", "'", "wp", "\\u", "pass", "'_", "]_", ")_", "+_", "\"\\\\", "n", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "olds", "ite", "type_", "in_", "[_", "'", "html", "'_", ",_", "'", "php", "'_", "]_", "and_", "stype_", "!=_", "'", "php", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "update", "Site", "Info_", "(_", "self_", ",_", "ee", "\\u", "domain_", ",_", "stype_", "=_", "stype_", ",_", "cache_", "=_", "cache_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "db", "\\u", "name_", "=_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "db", "\\u", "user_", "=_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "user", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "db", "\\u", "password_", "=_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "pass", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "db", "\\u", "host_", "=_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "host", "'_", "]_", ",_", "hh", "vm_", "=_", "hh", "vm_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "page", "speed_", "=_", "page", "speed_", ",_", "ssl_", "=_", "True_", "if_", "check", "\\u", "site_", "._", "is", "\\u", "ssl_", "else_", "False_", ",_", "php", "\\u", "version_", "=_", "check", "\\u", "php", "\\u", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "update", "Site", "Info_", "(_", "self_", ",_", "ee", "\\u", "domain_", ",_", "stype_", "=_", "stype_", ",_", "cache_", "=_", "cache_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hh", "vm_", "=_", "hh", "vm_", ",_", "page", "speed_", "=_", "page", "speed_", ",_", "ssl_", "=_", "True_", "if_", "check", "\\u", "site_", "._", "is", "\\u", "ssl_", "else_", "False_", ",_", "php", "\\u", "version_", "=_", "check", "\\u", "php", "\\u", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Success", "full", "y", " ", "update", "d", " ", "site", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "http", "://", "{", "0", "}\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "EE", "Site", "Delete", "Controller_", "(_", "Ce", "ment", "Base", "Controller_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "label_", "=_", "'", "delete", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stacked", "\\u", "on_", "=_", "'", "site", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stacked", "\\u", "type_", "=_", "'", "nest", "ed", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "description_", "=_", "'", "delete", " ", "an", " ", "exist", "ing", " ", "webs", "ite", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arguments_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'", "site", "\\u", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "'", "domain", " ", "name", " ", "to", " ", "be", " ", "delete", "d", "'_", ",_", "nargs_", "=_", "'?'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'--", "no", "-", "prompt", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "\"", "doesnt", " ", "ask", " ", "permissi", "on", " ", "for", " ", "delete", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "'", "store", "\\u", "true", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'-", "f", "'_", ",_", "'--", "force", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "\"", "force", "full", "y", " ", "delete", " ", "site", " ", "and", " ", "configura", "tion", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "'", "store", "\\u", "true", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'--", "all", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "\"", "delete", " ", "all", "\"_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'--", "db", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "\"", "delete", " ", "db", " ", "only", "\"_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'--", "files", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "\"", "delete", " ", "webr", "oot", " ", "only", "\"_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "EE", "Site", "Delete", "Controller_", "(_", "Ce", "ment", "Base", "Controller_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "expose_", "(_", "help_", "=_", "\"", "Delete", " ", "webs", "ite", " ", "configura", "tion", " ", "and", " ", "files", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "expose_", "(_", "hide_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "default_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "not_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", "=_", "(_", "input_", "(_", "'", "Enter", " ", "site", " ", "name", " ", ":", " ", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "strip_", "(_", ")_", ")_", "\\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 ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "'", "coul", "d", " ", "not", " ", "input", " ", "site", " ", "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_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", "=_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "ee", "\\u", "domain_", ",_", "ee", "\\u", "www", "\\u", "domain_", ")_", "=_", "Validate", "Domain_", "(_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ee", "\\u", "db", "\\u", "name_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ee", "\\u", "prompt_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ee", "\\u", "ngin", "x", "\\u", "prompt_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mark", "\\u", "db", "\\u", "delete", "\\u", "prompt_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mark", "\\u", "webr", "oot", "\\u", "delete", "\\u", "prompt_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mark", "\\u", "db", "\\u", "deleted_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mark", "\\u", "webr", "oot", "\\u", "deleted_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "check", "\\u", "domain", "\\u", "exists_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "site", " ", "{", "0", "}", " ", "doe", "s", " ", "not", " ", "exist", "\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "(_", "not_", "self_", "._", "app_", "._", "pargs_", "._", "db_", ")_", "and_", "(_", "not_", "self_", "._", "app_", "._", "pargs_", "._", "files_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "not_", "self_", "._", "app_", "._", "pargs_", "._", "all_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "app_", "._", "pargs_", "._", "all_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Gather", " ", "informati", "on", " ", "from", " ", "ee", "-", "db", " ", "for", " ", "ee", "\\u", "domain_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "check", "\\u", "site_", "=_", "get", "Site", "Info_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ee", "\\u", "site", "\\u", "type_", "=_", "check", "\\u", "site_", "._", "site", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ee", "\\u", "site", "\\u", "webr", "oot_", "=_", "check", "\\u", "site_", "._", "site", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ee", "\\u", "site", "\\u", "webr", "oot_", "==_", "'", "delete", "d", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mark", "\\u", "webr", "oot", "\\u", "deleted_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ee", "\\u", "site", "\\u", "type_", "in_", "[_", "'", "mysql", "'_", ",_", "'", "wp", "'_", ",_", "'", "wps", "ub", "dir", "'_", ",_", "'", "wps", "ub", "domain", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ee", "\\u", "db", "\\u", "name_", "=_", "check", "\\u", "site_", "._", "db", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ee", "\\u", "db", "\\u", "user_", "=_", "check", "\\u", "site_", "._", "db", "\\u", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ee", "\\u", "mysql", "\\u", "grant", "\\u", "host_", "=_", "self_", "._", "app_", "._", "config_", "._", "get_", "(_", "'", "mysql", "'_", ",_", "'", "grant", "-", "host", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ee", "\\u", "db", "\\u", "name_", "==_", "'", "delete", "d", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mark", "\\u", "db", "\\u", "deleted_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "app_", "._", "pargs_", "._", "all_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "app_", "._", "pargs_", "._", "db_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "app_", "._", "pargs_", "._", "files_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "app_", "._", "pargs_", "._", "all_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mark", "\\u", "db", "\\u", "deleted_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "app_", "._", "pargs_", "._", "files_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Delete", " ", "webs", "ite", " ", "database_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "app_", "._", "pargs_", "._", "db_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ee", "\\u", "db", "\\u", "name_", "!=_", "'", "delete", "d", "'_", "and_", "ee", "\\u", "db", "\\u", "name_", "!=_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "app_", "._", "pargs_", "._", "no", "\\u", "prompt_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "ee", "\\u", "db", "\\u", "prompt_", "=_", "input_", "(_", "'", "Are", " ", "you", " ", "sure", ",", " ", "you", " ", "want", " ", "to", " ", "delete", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "databa", "se", " ", "[", "y", "/", "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 ", " ", "_", "ee", "\\u", "db", "\\u", "prompt_", "=_", "'", "Y", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mark", "\\u", "db", "\\u", "delete", "\\u", "prompt_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ee", "\\u", "db", "\\u", "prompt_", "==_", "'", "Y", "'_", "or_", "ee", "\\u", "db", "\\u", "prompt_", "==_", "'", "y", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "mark", "\\u", "db", "\\u", "delete", "\\u", "prompt_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Del", "eti", "ng", " ", "Databa", "se", ",", " ", "{", "0", "},", " ", "user", " ", "{", "1", "}\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "ee", "\\u", "db", "\\u", "name_", ",_", "ee", "\\u", "db", "\\u", "user_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delete", "DB_", "(_", "self_", ",_", "ee", "\\u", "db", "\\u", "name_", ",_", "ee", "\\u", "db", "\\u", "user_", ",_", "ee", "\\u", "mysql", "\\u", "grant", "\\u", "host_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Site", "Info_", "(_", "self_", ",_", "ee", "\\u", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "db", "\\u", "name_", "=_", "'", "delete", "d", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "db", "\\u", "user_", "=_", "'", "delete", "d", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "db", "\\u", "password_", "=_", "'", "delete", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mark", "\\u", "db", "\\u", "deleted_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Delete", "d", " ", "Databa", "se", " ", "success", "full", "y", ".\"_", ")_", "\\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 ", " _", "mark", "\\u", "db", "\\u", "deleted_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Do", "es", " ", "not", " ", "see", "ms", " ", "to", " ", "have", " ", "databa", "se", " ", "for", " ", "this", " ", "site", ".\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Delete", " ", "webr", "oot_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "app_", "._", "pargs_", "._", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ee", "\\u", "site", "\\u", "webr", "oot_", "!=_", "'", "delete", "d", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "app_", "._", "pargs_", "._", "no", "\\u", "prompt_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "ee", "\\u", "web", "\\u", "prompt_", "=_", "input_", "(_", "'", "Are", " ", "you", " ", "sure", ",", " ", "you", " ", "want", " ", "to", " ", "delete", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "webr", "oot", " ", "[", "y", "/", "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 ", " ", "_", "ee", "\\u", "web", "\\u", "prompt_", "=_", "'", "Y", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mark", "\\u", "webr", "oot", "\\u", "delete", "\\u", "prompt_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ee", "\\u", "web", "\\u", "prompt_", "==_", "'", "Y", "'_", "or_", "ee", "\\u", "web", "\\u", "prompt_", "==_", "'", "y", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "mark", "\\u", "webr", "oot", "\\u", "delete", "\\u", "prompt_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Del", "eti", "ng", " ", "Web", "root", ",", " ", "{", "0", "}\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "ee", "\\u", "site", "\\u", "webr", "oot_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delete", "Web", "Root_", "(_", "self_", ",_", "ee", "\\u", "site", "\\u", "webr", "oot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Site", "Info_", "(_", "self_", ",_", "ee", "\\u", "domain_", ",_", "webr", "oot_", "=_", "'", "delete", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mark", "\\u", "webr", "oot", "\\u", "deleted_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Delete", "d", " ", "webr", "oot", " ", "success", "full", "y", "\"_", ")_", "\\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 ", " _", "mark", "\\u", "webr", "oot", "\\u", "deleted_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Web", "root", " ", "see", "ms", " ", "to", " ", "be", " ", "alr", "ead", "y", " ", "delete", "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_", "not_", "self_", "._", "app_", "._", "pargs_", "._", "force_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "mark", "\\u", "webr", "oot", "\\u", "deleted_", "and_", "mark", "\\u", "db", "\\u", "deleted_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", " ", "Delete", " ", "ngin", "x", " ", "conf_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "remove", "Ng", "inx", "Conf_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delete", "Site", "Info_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Delete", "d", " ", "site", " ", "{", "0", "}\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "else", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Log", ".", "error", "(", "self", ",", " ", "\"", " ", "site", " ", "{", "0", "}", " ", "doe", "s", " ", "not", " ", "exist", "s", "\".", "format", "(", "ee", "\\u", "domain", "))", "_", "\\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 ", " _", "if_", "(_", "mark", "\\u", "db", "\\u", "delete", "\\u", "prompt_", "or_", "mark", "\\u", "webr", "oot", "\\u", "delete", "\\u", "prompt_", "or_", "(_", "mark", "\\u", "webr", "oot", "\\u", "deleted_", "and_", "mark", "\\u", "db", "\\u", "deleted_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", " ", "Delete", " ", "ngin", "x", " ", "conf_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "remove", "Ng", "inx", "Conf_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delete", "Site", "Info_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Delete", "d", " ", "site", " ", "{", "0", "}\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "EE", "Site", "List", "Controller_", "(_", "Ce", "ment", "Base", "Controller_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "label_", "=_", "'", "list", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stacked", "\\u", "on_", "=_", "'", "site", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stacked", "\\u", "type_", "=_", "'", "nest", "ed", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "description_", "=_", "'", "List", " ", "webs", "ites", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arguments_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'--", "enable", "d", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "'", "List", " ", "enable", "d", " ", "webs", "ites", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'--", "disable", "d", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "help_", "=_", "\"", "List", " ", "disable", "d", " ", "webs", "ites", "\"_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "EE", "Site", "List", "Controller_", "(_", "Ce", "ment", "Base", "Controller_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "expose_", "(_", "help_", "=_", "\"", "List", "s", " ", "webs", "ites", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "default_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sites_", "=_", "get", "All", "sites_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "sites_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "app_", "._", "pargs_", "._", "enabled_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "site_", "in_", "sites_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "site_", "._", "is", "\\u", "enabled_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "Log_", "._", "info_", "(_", "self_", ",_", "\"{", "0", "}\"_", "._", "format_", "(_", "site_", "._", "site", "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_", "elif_", "self_", "._", "app_", "._", "pargs_", "._", "disabled_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "site_", "in_", "sites_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "not_", "site_", "._", "is", "\\u", "enabled_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "Log_", "._", "info_", "(_", "self_", ",_", "\"{", "0", "}\"_", "._", "format_", "(_", "site_", "._", "site", "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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "site_", "in_", "sites_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "Log_", "._", "info_", "(_", "self_", ",_", "\"{", "0", "}\"_", "._", "format_", "(_", "site_", "._", "site", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load_", "(_", "app_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "register", " ", "the", " ", "plugin", " ", "class", "..", " ", "this", " ", "only", " ", "happ", "ens", " ", "if", " ", "the", " ", "plugin", " ", "is", " ", "enabled_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "handler_", "._", "register_", "(_", "EE", "Site", "Controller_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "register_", "(_", "EE", "Site", "Creat", "e", "Controller_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "register_", "(_", "EE", "Site", "Update", "Controller_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "register_", "(_", "EE", "Site", "Delete", "Controller_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "register_", "(_", "EE", "Site", "List", "Controller_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "register_", "(_", "EE", "Site", "Edit", "Controller_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "register", " ", "a", " ", "hook", " ", "(", "function", ")", " ", "to", " ", "run", " ", "after", " ", "argu", "ment", "s", " ", "are", " ", "parsed", "._", "\\u\\u\\uNL\\u\\u\\u_", "hook_", "._", "register_", "(_", "'", "post", "\\u", "argu", "ment", "\\u", "pars", "ing", "'_", ",_", "ee", "\\u", "site", "\\u", "hook_", ")_" ]
[ 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, 0, 1, 1, 1, 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,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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 ]
Except block handles 'BaseException'
Esri/ops-server-config/SupportFiles/UtilitiesArcPy.py
[ { "content": "def uploadServiceDefinition(sdFilePath, agsPubConnectionFile, startService=True):\n success = True\n pymsg = \"\"\n \n try:\n if startService:\n startService = \"STARTED\"\n else:\n startService = \"STOPPED\"\n \n arcpy.UploadServiceDefinition_server(sdFilePath, agsPubConnectionFile, in_startupType=startService, in_cluster='default')\n \n except:\n success = False\n pymsg = \"\\tError Info:\\n\\t\" + str(sys.exc_info()[1])\n \n finally:\n return [success, pymsg]", "metadata": "root.uploadServiceDefinition", "header": "['module', '___EOS___']", "index": 26 }, { "content": "def copyData(sourcePath, destinationPath, dataType=\"\"):\n success = True\n pymsg = \"\"\n \n try:\n if arcpy.Exists(destinationPath):\n print \"\\tWARNING: dataset already exists in destination: \" + destinationPath\n print \"\\tIf dataset is participating in a relationship, then might have been copied when parent was copied.\"\n else:\n arcpy.Copy_management(sourcePath, destinationPath)\n \n except:\n success = False\n pymsg = \"\\tError Info:\\n\\t\" + str(sys.exc_info()[1])\n \n finally:\n return [success, pymsg]", "metadata": "root.copyData", "header": "['module', '___EOS___']", "index": 46 }, { "content": "def copyGDBData(sourceGDBPath, destinationGDBPath):\n success = True\n pymsg = \"\"\n printMsg = True\n debug = False\n \n try:\n #startTime = datetime.now()\n print '\\n{:<14}{:<100}'.format(\"Source:\", sourceGDBPath)\n print '{:<14}{:<100}\\n'.format(\"Destination:\", destinationGDBPath)\n \n # Verify input parameter types\n \n # Check out extensions\n print \"- Check out network license...\"\n if arcpy.CheckExtension(\"Network\") == \"Available\":\n arcpy.CheckOutExtension(\"Network\")\n else:\n # Raise a custom exception\n raise LicenseError\n \n descGDB = arcpy.Describe(sourceGDBPath)\n \n if debug:\n # Print some Describe Object properties\n if hasattr(descGDB, \"name\"):\n print \"Name: \" + descGDB.name\n if hasattr(descGDB, \"dataType\"):\n print \"DataType: \" + descGDB.dataType\n if hasattr(descGDB, \"catalogPath\"):\n print \"CatalogPath: \" + descGDB.catalogPath\n \n # Find children datasets\n datasets = []\n copyExcludeList = []\n for child in descGDB.children:\n if child.dataType != \"RelationshipClass\":\n datasets.append(child.name)\n else:\n descRel = arcpy.Describe(sourceGDBPath + \"/\" + child.name)\n for destClassName in descRel.destinationClassNames:\n copyExcludeList.append(destClassName)\n \n # Do not copy the datasets that are the destination datasets in\n # relationships since these datasets will automatically be\n # copied when the origin datasets are copied\n copyList = [dataset for dataset in datasets if dataset not in copyExcludeList]\n \n if debug:\n print \"\\nAll datasets (excluding relationship classes):\"\n print datasets\n print \"\\nDestination tables involved in relationship classes:\"\n print copyExcludeList\n print \"\\nCopy the following:\"\n print copyList\n \n if len(copyList) > 0:\n n = 1\n print \"- Copying database data...\"\n for dataset in copyList:\n srcPath = os.path.join(sourceGDBPath, dataset)\n destPath = os.path.join(destinationGDBPath, dataset)\n print \"\\tDataset: {} ({}/{})\".format(dataset, n, len(copyList))\n if arcpy.Exists(destPath):\n print \"\\t\\tWARNING: Will not copy dataset.\"\n print \"\\t\\tDataset already exists in destination: \" + destPath\n print \"\\t\\t(If dataset is participating in a relationship, then it was copied when origin dataset(s) was copied).\"\n else:\n print \"\\tCopying...\"\n results = copyData(srcPath, destPath)\n copySuccess = checkResults(results, printMsg)\n if not copySuccess:\n success = False\n n = n + 1\n else:\n print \"- No database data to copy.\"\n \n except LicenseError:\n success = False\n print \"ERROR: Network license is unavailable\"\n except:\n success = False\n pymsg = \"\\tError Info:\\n\\t\" + str(sys.exc_info()[1])\n \n finally:\n arcpy.CheckInExtension(\"Network\")\n # print '{:<14}{:%Y-%m-%d %H:%M:%S}'.format(\"Start time:\", startTime)\n # print '{:<14}{:%Y-%m-%d %H:%M:%S}'.format(\"End time:\", datetime.now())\n return [success, pymsg]", "metadata": "root.copyGDBData", "header": "['module', '___EOS___']", "index": 64 }, { "content": "def repairMosaicDatasetPaths(mosaicDatasetPath, pathsList):\n success = True\n pymsg = \"\"\n \n try:\n \n arcpy.RepairMosaicDatasetPaths_management(mosaicDatasetPath, pathsList)\n \n except:\n success = False\n pymsg = \"\\tError Info:\\n\\t\" + str(sys.exc_info()[1])\n \n finally:\n return [success, pymsg]", "metadata": "root.repairMosaicDatasetPaths", "header": "['module', '___EOS___']", "index": 172 }, { "content": "def createAGSConnectionFile(agsConnFolderPath, agsConnFile, serverName,\n userName, passWord, port=6080, useSSL=False,\n connectionType=\"ADMINISTER_GIS_SERVICES\",\n serverType=\"ARCGIS_SERVER\",\n saveUserNamePassWord=\"SAVE_USERNAME\"):\n success = True\n pymsg = \"\"\n \n try:\n \n agsConnFilePath = agsConnFolderPath + os.sep + agsConnFile\n \n # Delete connection file if it already exists\n if os.path.exists(agsConnFilePath):\n os.remove(agsConnFilePath)\n \n # Build URL\n if useSSL:\n targetAGSURL = \"https\"\n else:\n targetAGSURL = \"http\"\n \n targetAGSURL = \"{}://{}\".format(targetAGSURL, serverName)\n \n if port:\n targetAGSURL = \"{}:{}\".format(targetAGSURL, port)\n \n targetAGSURL = \"{}/arcgis/admin\".format(targetAGSURL)\n \n # Create connection file\n arcpy.mapping.CreateGISServerConnectionFile(\n connectionType, agsConnFolderPath, agsConnFile,\n targetAGSURL, serverType, True, None, userName, passWord,\n saveUserNamePassWord)\n \n except:\n success = False\n pymsg = \"\\tError Info:\\n\\t\" + str(sys.exc_info()[1])\n \n finally:\n return [success, pymsg]", "metadata": "root.createAGSConnectionFile", "header": "['module', '___EOS___']", "index": 187 } ]
[ { "span": "except:", "start_line": 38, "start_column": 4, "end_line": 38, "end_column": 11 }, { "span": "except:", "start_line": 57, "start_column": 4, "end_line": 57, "end_column": 11 }, { "span": "except:", "start_line": 144, "start_column": 4, "end_line": 144, "end_column": 11 }, { "span": "except:", "start_line": 180, "start_column": 4, "end_line": 180, "end_column": 11 }, { "span": "except:", "start_line": 222, "start_column": 4, "end_line": 222, "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_", "upload", "Service", "Definition_", "(_", "sd", "File", "Path_", ",_", "ags", "Pub", "Connect", "ion", "File_", ",_", "start", "Service_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "success_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pym", "sg_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "start", "Service_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "Service_", "=_", "\"", "START", "ED", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "Service_", "=_", "\"", "STOPPED", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "arcpy_", "._", "Upload", "Service", "Definit", "ion", "\\u", "server_", "(_", "sd", "File", "Path_", ",_", "ags", "Pub", "Connect", "ion", "File_", ",_", "in", "\\u", "start", "up", "Type_", "=_", "start", "Service_", ",_", "in", "\\u", "cluster_", "=_", "'", "default", "'_", ")_", "\\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 ", " _", "success_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pym", "sg_", "=_", "\"\\\\", "t", "Error", " ", "Info", ":\\\\", "n", "\\\\", "t", "\"_", "+_", "str_", "(_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "success_", ",_", "pym", "sg_", "]_", "\\u\\u\\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_", "copy", "Data_", "(_", "source", "Path_", ",_", "destinat", "ion", "Path_", ",_", "data", "Type_", "=_", "\"\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "success_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pym", "sg_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "arcpy_", "._", "Exists_", "(_", "destinat", "ion", "Path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"\\\\", "t", "WARN", "ING", ":", " ", "dataset", " ", "alr", "ead", "y", " ", "exist", "s", " ", "in", " ", "destinat", "ion", ":", " ", "\"_", "+_", "destinat", "ion", "Path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"\\\\", "t", "If", " ", "dataset", " ", "is", " ", "participati", "ng", " ", "in", " ", "a", " ", "relation", "ship", ",", " ", "then", " ", "mig", "ht", " ", "have", " ", "bee", "n", " ", "copie", "d", " ", "whe", "n", " ", "parent", " ", "was", " ", "copie", "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 ", " _", "arcpy_", "._", "Copy", "\\u", "management_", "(_", "source", "Path_", ",_", "destinat", "ion", "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_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "success_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pym", "sg_", "=_", "\"\\\\", "t", "Error", " ", "Info", ":\\\\", "n", "\\\\", "t", "\"_", "+_", "str_", "(_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "success_", ",_", "pym", "sg_", "]_", "\\u\\u\\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_", "copy", "GD", "BD", "ata_", "(_", "source", "GD", "BP", "ath_", ",_", "destinat", "ion", "GD", "BP", "ath_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "success_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pym", "sg_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "Msg_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "debug_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "start", "Time", " ", "=", " ", "datetime", ".", "now", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'\\\\", "n", "{:", "<", "14", "}{", ":", "<", "100", "}'_", "._", "format_", "(_", "\"", "Sou", "rce", ":\"_", ",_", "source", "GD", "BP", "ath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'{:", "<", "14", "}{", ":", "<", "100", "}\\\\", "n", "'_", "._", "format_", "(_", "\"", "Dest", "ination", ":\"_", ",_", "destinat", "ion", "GD", "BP", "ath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Verify", " ", "input", " ", "parameter", " ", "types_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "out", " ", "extensions_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"-", " ", "Check", " ", "out", " ", "network", " ", "license", "...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "arcpy_", "._", "Check", "Extension_", "(_", "\"", "Network", "\"_", ")_", "==_", "\"", "Avail", "able", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arcpy_", "._", "Check", "Out", "Extension_", "(_", "\"", "Network", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Rai", "se", " ", "a", " ", "custom", " ", "exception_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "License", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "desc", "GD", "B_", "=_", "arcpy_", "._", "Describe", "_", "(_", "source", "GD", "BP", "ath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "debug_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Print", " ", "some", " ", "Describe", " ", "Object", " ", "properties_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "desc", "GD", "B_", ",_", "\"", "name", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Name", ":", " ", " ", " ", " ", "\"_", "+_", "desc", "GD", "B_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "desc", "GD", "B_", ",_", "\"", "data", "Type", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Data", "Type", ":", " ", " ", " ", " ", "\"_", "+_", "desc", "GD", "B_", "._", "data", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "desc", "GD", "B_", ",_", "\"", "catal", "og", "Path", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Catalog", "Path", ":", " ", "\"_", "+_", "desc", "GD", "B_", "._", "catal", "og", "Path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fin", "d", " ", "child", "ren", " ", "datasets_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "datasets_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "copy", "Exclude", "List_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "child_", "in_", "desc", "GD", "B_", "._", "children_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "child_", "._", "data", "Type_", "!=_", "\"", "Relationship", "Class", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "datasets_", "._", "append_", "(_", "child_", "._", "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 ", " _", "desc", "Rel", "_", "=_", "arcpy_", "._", "Describe", "_", "(_", "source", "GD", "BP", "ath_", "+_", "\"/\"_", "+_", "child_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "dest", "Class", "Name_", "in_", "desc", "Rel", "_", "._", "destinat", "ion", "Class", "Names_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "copy", "Exclude", "List_", "._", "append_", "(_", "dest", "Class", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Do", " ", "not", " ", "copy", " ", "the", " ", "dataset", "s", " ", "tha", "t", " ", "are", " ", "the", " ", "destinat", "ion", " ", "dataset", "s", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "relation", "ships", " ", "sinc", "e", " ", "these", " ", "dataset", "s", " ", "will", " ", "automati", "call", "y", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "copie", "d", " ", "whe", "n", " ", "the", " ", "orig", "in", " ", "dataset", "s", " ", "are", " ", "copied_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "copy", "List_", "=_", "[_", "dataset_", "for_", "dataset_", "in_", "datasets_", "if_", "dataset_", "not_", "in_", "copy", "Exclude", "List_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "debug_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"\\\\", "n", "All", " ", "dataset", "s", " ", "(", "excluding", " ", "relation", "ship", " ", "classe", "s", "):\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "datasets_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"\\\\", "n", "Dest", "ination", " ", "tables", " ", "involved", " ", "in", " ", "relation", "ship", " ", "classe", "s", ":\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "copy", "Exclude", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"\\\\", "n", "Copy", " ", "the", " ", "follow", "ing", ":\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "copy", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "copy", "List_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"-", " ", "Copy", "ing", " ", "databa", "se", " ", "data", "...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "dataset_", "in_", "copy", "List_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "src", "Path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "source", "GD", "BP", "ath_", ",_", "dataset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dest", "Path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "destinat", "ion", "GD", "BP", "ath_", ",_", "dataset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"\\\\", "t", "Datas", "et", ":", " ", "{}", " ", "({}", "/{}", ")\"_", "._", "format_", "(_", "dataset_", ",_", "n_", ",_", "len_", "(_", "copy", "List_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "arcpy_", "._", "Exists_", "(_", "dest", "Path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "\"\\\\", "t", "\\\\", "t", "WARN", "ING", ":", " ", "Wil", "l", " ", "not", " ", "copy", " ", "dataset", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"\\\\", "t", "\\\\", "t", "Datas", "et", " ", "alr", "ead", "y", " ", "exist", "s", " ", "in", " ", "destinat", "ion", ":", " ", "\"_", "+_", "dest", "Path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"\\\\", "t", "\\\\", "t", "(", "If", " ", "dataset", " ", "is", " ", "participati", "ng", " ", "in", " ", "a", " ", "relation", "ship", ",", " ", "then", " ", "it", " ", "was", " ", "copie", "d", " ", "whe", "n", " ", "orig", "in", " ", "dataset", "(", "s", ")", " ", "was", " ", "copie", "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 ", " ", "_", "print_", "\"\\\\", "t", "Copy", "ing", "...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "copy", "Data_", "(_", "src", "Path_", ",_", "dest", "Path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "copy", "Success_", "=_", "check", "Results_", "(_", "results_", ",_", "print", "Msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "copy", "Success_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "success_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "n_", "=_", "n_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"-", " ", "No", " ", "databa", "se", " ", "data", " ", "to", " ", "copy", ".\"_", "\\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_", "License", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "success_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "ERROR", ":", " ", "Network", " ", "license", " ", "is", " ", "unava", "ilab", "le", "\"_", "\\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 ", " _", "success_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pym", "sg_", "=_", "\"\\\\", "t", "Error", " ", "Info", ":\\\\", "n", "\\\\", "t", "\"_", "+_", "str_", "(_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arcpy_", "._", "Check", "In", "Extension_", "(_", "\"", "Network", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", " ", "'{:", "<", "14", "}{", ":", "%", "Y", "-%", "m", "-%", "d", " ", "%", "H", ":", "%", "M", ":", "%", "S", "}'", ".", "format", "(\"", "Start", " ", "time", ":\"", ",", " ", "start", "Time", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "'{:", "<", "14", "}{", ":", "%", "Y", "-%", "m", "-%", "d", " ", "%", "H", ":", "%", "M", ":", "%", "S", "}'", ".", "format", "(\"", "End", " ", "time", ":\"", ",", " ", "datetime", ".", "now", "())", "_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "[_", "success_", ",_", "pym", "sg_", "]_", "\\u\\u\\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_", "repair", "Mos", "aic", "Datas", "et", "Paths_", "(_", "mosaic", "Datas", "et", "Path_", ",_", "path", "s", "List_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "success_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pym", "sg_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arcpy_", "._", "Repair", "Mos", "aic", "Datas", "et", "Path", "s", "\\u", "management_", "(_", "mosaic", "Datas", "et", "Path_", ",_", "path", "s", "List_", ")_", "\\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 ", " _", "success_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pym", "sg_", "=_", "\"\\\\", "t", "Error", " ", "Info", ":\\\\", "n", "\\\\", "t", "\"_", "+_", "str_", "(_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "success_", ",_", "pym", "sg_", "]_", "\\u\\u\\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_", "create", "AG", "SC", "onnect", "ion", "File_", "(_", "ags", "Con", "n", "Fold", "er", "Path_", ",_", "ags", "Con", "n", "File_", ",_", "server", "Name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "Name_", ",_", "pass", "Word_", ",_", "port_", "=_", "608", "0_", ",_", "use", "SSL_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "connecti", "on", "Type_", "=_", "\"", "ADM", "INI", "STE", "R", "\\u", "GI", "S", "\\u", "SERVICES", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "server", "Type_", "=_", "\"", "ARC", "GI", "S", "\\u", "SERVER", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "save", "User", "Name", "Pass", "Word_", "=_", "\"", "SAVE", "\\u", "USER", "NAME", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "success_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pym", "sg_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ags", "Con", "n", "File", "Path_", "=_", "ags", "Con", "n", "Fold", "er", "Path_", "+_", "os_", "._", "sep_", "+_", "ags", "Con", "n", "File_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Delete", " ", "connecti", "on", " ", "file", " ", "if", " ", "it", " ", "alr", "ead", "y", " ", "exists_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "ags", "Con", "n", "File", "Path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "remove_", "(_", "ags", "Con", "n", "File", "Path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Build", " ", "URL_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "use", "SSL_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target", "AG", "SUR", "L_", "=_", "\"", "https", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target", "AG", "SUR", "L_", "=_", "\"", "http", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "target", "AG", "SUR", "L_", "=_", "\"{}", "://{}", "\"_", "._", "format_", "(_", "target", "AG", "SUR", "L_", ",_", "server", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "port_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target", "AG", "SUR", "L_", "=_", "\"{}", ":{}\"_", "._", "format_", "(_", "target", "AG", "SUR", "L_", ",_", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "target", "AG", "SUR", "L_", "=_", "\"{}", "/", "arc", "gi", "s", "/", "admin", "\"_", "._", "format_", "(_", "target", "AG", "SUR", "L_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "connecti", "on", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "arcpy_", "._", "mapping_", "._", "Creat", "e", "GI", "SS", "erver", "Connect", "ion", "File_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "connecti", "on", "Type_", ",_", "ags", "Con", "n", "Fold", "er", "Path_", ",_", "ags", "Con", "n", "File_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "target", "AG", "SUR", "L_", ",_", "server", "Type_", ",_", "True_", ",_", "None_", ",_", "user", "Name_", ",_", "pass", "Word_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "save", "User", "Name", "Pass", "Word_", ")_", "\\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 ", " _", "success_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pym", "sg_", "=_", "\"\\\\", "t", "Error", " ", "Info", ":\\\\", "n", "\\\\", "t", "\"_", "+_", "str_", "(_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "success_", ",_", "pym", "sg_", "]_" ]
[ 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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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, 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 ]
Variable defined multiple times
sassoftware/conary/conary_test/clienttest/modelupdatetest.py
[ { "content": " @testhelp.context('sysmodel')\n def testRedirect(self):\n self.addComponent('bar:runtime=1.0', fileContents = [ '/bar:runtime'] )\n self.addCollection('bar=1.0', [ ':runtime'] )\n\n self.addComponent('redirect:runtime=1.0')\n self.addCollection('redirect=1.0', [ ':runtime'] )\n\n self.addComponent('foo:runtime=1.0', fileContents = [ '/foo:runtime'] )\n self.addCollection('foo=1.0', [ ':runtime' ])\n\n redirectRecipe = \"\\n\".join([\n 'class testRedirect(RedirectRecipe):',\n ' name = \"redirect\"',\n ' version = \"2.0\"',\n ' clearBuildReqs()',\n '',\n ' def setup(r):',\n ' r.addRedirect(\"foo\", \"localhost@rpl:linux\")' ])\n\n built, d = self.buildRecipe(redirectRecipe, \"testRedirect\")\n\n self._applyModel([ 'install redirect=2.0' ])\n self.verifyFile(self.rootDir + '/foo:runtime')\n\n redirectRecipe = \"\\n\".join([\n 'class testRedirect(RedirectRecipe):',\n ' name = \"foo\"',\n ' version = \"2.0\"',\n ' clearBuildReqs()',\n '',\n ' def setup(r):',\n ' r.addRedirect(\"bar\", \"localhost@rpl:linux\")' ])\n\n built, d = self.buildRecipe(redirectRecipe, \"testRedirect\")\n self._applyModel([ 'install redirect=2.0' ])\n self.verifyFile(self.rootDir + '/bar:runtime')\n\n redirectRecipe = \"\\n\".join([\n 'class testRedirect(RedirectRecipe):',\n ' name = \"bar\"',\n ' version = \"2.0\"',\n ' clearBuildReqs()',\n '',\n ' def setup(r):',\n ' r.addRedirect(\"redirect\",\"localhost@rpl:linux\")' ])\n built, d = self.buildRecipe(redirectRecipe, \"testRedirect\")\n\n self.assertRaisesRegexp(conaryclient.UpdateError,\n '^Redirect loop found which includes troves redirect, foo$',\n self._applyModel, [ 'install redirect=2.0' ])", "metadata": "root.ModelUpdateTest.testRedirect", "header": "['class', 'ModelUpdateTest', '(', 'rephelp', '.', 'RepositoryHelper', ')', ':', '___EOS___']", "index": 478 } ]
[ { "span": "built,", "start_line": 498, "start_column": 8, "end_line": 498, "end_column": 13 }, { "span": "d ", "start_line": 498, "start_column": 15, "end_line": 498, "end_column": 16 }, { "span": "built,", "start_line": 512, "start_column": 8, "end_line": 512, "end_column": 13 }, { "span": "d ", "start_line": 512, "start_column": 15, "end_line": 512, "end_column": 16 } ]
[ { "span": "built,", "start_line": 524, "start_column": 8, "end_line": 524, "end_column": 13 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Model", "Update", "Test_", "(_", "rep", "help_", "._", "Repos", "itor", "y", "Helper_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "testh", "elp", "_", "._", "context_", "(_", "'", "sys", "model", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test", "Redirect_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "Component_", "(_", "'", "bar", ":", "runt", "ime", "=", "1.0", "'_", ",_", "file", "Contents_", "=_", "[_", "'/", "bar", ":", "runt", "ime", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Collection_", "(_", "'", "bar", "=", "1.0", "'_", ",_", "[_", "':", "runt", "ime", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "add", "Component_", "(_", "'", "redirec", "t", ":", "runt", "ime", "=", "1.0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Collection_", "(_", "'", "redirec", "t", "=", "1.0", "'_", ",_", "[_", "':", "runt", "ime", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "add", "Component_", "(_", "'", "foo", ":", "runt", "ime", "=", "1.0", "'_", ",_", "file", "Contents_", "=_", "[_", "'/", "foo", ":", "runt", "ime", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Collection_", "(_", "'", "foo", "=", "1.0", "'_", ",_", "[_", "':", "runt", "ime", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "redirec", "t", "Recipe_", "=_", "\"\\\\", "n", "\"_", "._", "join_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "class", " ", "test", "Redirect", "(", "Redirect", "Recip", "e", "):'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", " ", " ", " ", "name", " ", "=", " ", "\"", "redirec", "t", "\"'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", " ", " ", " ", "version", " ", "=", " ", "\"", "2.0", "\"'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", " ", " ", " ", "clear", "Build", "Re", "qs", "()'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", " ", " ", " ", "def", " ", "setup", "(", "r", "):'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", " ", " ", " ", "r", ".", "add", "Redirect", "(\"", "foo", "\",", " ", "\"", "local", "host", "@", "rpl", ":", "linux", "\")'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "built_", ",_", "d_", "=_", "self_", "._", "build", "Recipe_", "(_", "redirec", "t", "Recipe_", ",_", "\"", "test", "Redirect", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "appl", "y", "Model_", "(_", "[_", "'", "install", " ", "redirec", "t", "=", "2.0", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "verify", "File_", "(_", "self_", "._", "root", "Dir_", "+_", "'/", "foo", ":", "runt", "ime", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "redirec", "t", "Recipe_", "=_", "\"\\\\", "n", "\"_", "._", "join_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "class", " ", "test", "Redirect", "(", "Redirect", "Recip", "e", "):'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", " ", " ", " ", "name", " ", "=", " ", "\"", "foo", "\"'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", " ", " ", " ", "version", " ", "=", " ", "\"", "2.0", "\"'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", " ", " ", " ", "clear", "Build", "Re", "qs", "()'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", " ", " ", " ", "def", " ", "setup", "(", "r", "):'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", " ", " ", " ", "r", ".", "add", "Redirect", "(\"", "bar", "\",", " ", "\"", "local", "host", "@", "rpl", ":", "linux", "\")'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "built_", ",_", "d_", "=_", "self_", "._", "build", "Recipe_", "(_", "redirec", "t", "Recipe_", ",_", "\"", "test", "Redirect", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "appl", "y", "Model_", "(_", "[_", "'", "install", " ", "redirec", "t", "=", "2.0", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "verify", "File_", "(_", "self_", "._", "root", "Dir_", "+_", "'/", "bar", ":", "runt", "ime", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "redirec", "t", "Recipe_", "=_", "\"\\\\", "n", "\"_", "._", "join_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "class", " ", "test", "Redirect", "(", "Redirect", "Recip", "e", "):'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", " ", " ", " ", "name", " ", "=", " ", "\"", "bar", "\"'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", " ", " ", " ", "version", " ", "=", " ", "\"", "2.0", "\"'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", " ", " ", " ", "clear", "Build", "Re", "qs", "()'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", " ", " ", " ", "def", " ", "setup", "(", "r", "):'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", " ", " ", " ", "r", ".", "add", "Redirect", "(\"", "redirec", "t", "\",\"", "local", "host", "@", "rpl", ":", "linux", "\")'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "built_", ",_", "d_", "=_", "self_", "._", "build", "Recipe_", "(_", "redirec", "t", "Recipe_", ",_", "\"", "test", "Redirect", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Rai", "ses", "Regexp_", "(_", "cona", "ry", "client_", "._", "Update", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "^", "Redirect", " ", "loop", " ", "found", " ", "whi", "ch", " ", "include", "s", " ", "trove", "s", " ", "redirec", "t", ",", " ", "foo", "$'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "appl", "y", "Model_", ",_", "[_", "'", "install", " ", "redirec", "t", "=", "2.0", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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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, 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 ]
An assert statement has a side-effect
ResilientScience/wot/tests/sequitur_tests.py
[ { "content": "def test_input3():\n assert sequitur.run(open(\"tests/data/69k\").read()) == open(\"tests/data/69k.out\").read()", "metadata": "root.test_input3", "header": "['module', '___EOS___']", "index": 24 } ]
[ { "span": "assert sequitur.run(open(\"tests/data/69k\").read()) == open(\"tests/data/69k.out\").read()", "start_line": 25, "start_column": 4, "end_line": 25, "end_column": 91 } ]
[]
1
true
[ "[CLS]_", "An", "_", "assert_", "statement_", "has_", "a_", "side_", "-_", "effect_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "input", "3_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "seq", "uit", "ur_", "._", "run_", "(_", "open_", "(_", "\"", "tests", "/", "data", "/", "6", "9", "k", "\"_", ")_", "._", "read_", "(_", ")_", ")_", "==_", "open_", "(_", "\"", "tests", "/", "data", "/", "6", "9", "k", ".", "out", "\"_", ")_", "._", "read_", "(_", ")_" ]
[ 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
Unused import
karlnapf/kameleon-mcmc/kameleon_mcmc/kernel/PolynomialKernel.py
[ { "content": "\"\"\"\nThis program is free software; you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation; either version 3 of the License, or\n(at your option) any later version.\n\nWritten (W) 2013 Heiko Strathmann\nWritten (W) 2013 Dino Sejdinovic\n\"\"\"\n\nfrom numpy import array\n\nfrom kameleon_mcmc.kernel.Kernel import Kernel\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class PolynomialKernel(Kernel):\n \n \n ", "metadata": "root.PolynomialKernel", "header": "['module', '___EOS___']", "index": 15 }, { "content": " def __init__(self, degree,theta=0.2):\n Kernel.__init__(self)\n self.degree = degree\n self.theta = theta", "metadata": "root.PolynomialKernel.__init__", "header": "['class', 'PolynomialKernel', '(', 'Kernel', ')', ':', '___EOS___']", "index": 16 }, { "content": " def __str__(self):\n s=self.__class__.__name__+ \"=[\"\n s += \"degree=\"+ str(self.degree)\n s += \", \" + Kernel.__str__(self)\n s += \"]\"\n return s", "metadata": "root.PolynomialKernel.__str__", "header": "['class', 'PolynomialKernel', '(', 'Kernel', ')', ':', '___EOS___']", "index": 21 }, { "content": " def kernel(self, X, Y=None):\n \"\"\"\n Computes the polynomial kernel k(x,y)=(1+theta*<x,y>)^degree for the given data\n X - samples on right hand side\n Y - samples on left hand side, can be None in which case its replaced by X\n \"\"\"\n if Y is None:\n Y = X\n \n return pow(self.theta+X.dot(Y.T), self.degree)", "metadata": "root.PolynomialKernel.kernel", "header": "['class', 'PolynomialKernel', '(', 'Kernel', ')', ':', '___EOS___']", "index": 28 }, { "content": " def gradient(self, x, Y):\n \"\"\"\n Computes the gradient of the Polynomial kernel wrt. to the left argument, i.e.\n \\nabla_x k(x,y)=\\nabla_x (1+x^Ty)^d=d(1+x^Ty)^(d-1) y\n \n x - single sample on right hand side (1D vector)\n Y - samples on left hand side (2D matrix)\n \"\"\"\n assert(len(x.shape)==1)\n assert(len(Y.shape)==2)\n assert(len(x)==Y.shape[1])\n \n return self.degree*pow(1+x.dot(Y.T), self.degree)*Y", "metadata": "root.PolynomialKernel.gradient", "header": "['class', 'PolynomialKernel', '(', 'Kernel', ')', ':', '___EOS___']", "index": 39 } ]
[ { "span": "from numpy import array", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 23 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Thi", "s", " ", "program", " ", "is", " ", "free", " ", "software", ";", " ", "you", " ", "can", " ", "redis", "tribut", "e", " ", "it", " ", "and", "/", "or", " ", "modif", "y", "\\", "10", ";", "it", " ", "under", " ", "the", " ", "term", "s", " ", "of", " ", "the", " ", "GN", "U", " ", "General", " ", "Public", " ", "License", " ", "as", " ", "publi", "shed", " ", "by", "\\", "10", ";", "the", " ", "Free", " ", "Sof", "twa", "re", " ", "Foun", "dati", "on", ";", " ", "eit", "her", " ", "version", " ", "3", " ", "of", " ", "the", " ", "License", ",", " ", "or", "\\", "10", ";", "(", "at", " ", "your", " ", "option", ")", " ", "any", " ", "late", "r", " ", "version", ".", "\\", "10", ";", "\\", "10", ";", "Writ", "ten", " ", "(", "W", ")", " ", "2013", " ", "Hei", "ko", " ", "Strat", "hma", "nn", "\\", "10", ";", "Writ", "ten", " ", "(", "W", ")", " ", "2013", " ", "Din", "o", " ", "Se", "jd", "ino", "vic", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "numpy_", "import_", "array_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "kam", "ele", "on", "\\u", "mcmc", "_", "._", "kernel_", "._", "Kernel_", "import_", "Kernel_", "\\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_", "Polynomial", "Kernel_", "(_", "Kernel_", ")_", ":_", "\\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_", "Polynomial", "Kernel_", "(_", "Kernel_", ")_", ":_", "\\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_", ",_", "degree_", ",_", "theta_", "=_", "0.2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Kernel_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "degree_", "=_", "degree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "theta_", "=_", "theta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Polynomial", "Kernel_", "(_", "Kernel_", ")_", ":_", "\\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 ", " _", "s_", "=_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", "+_", "\"=", "[\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "+=_", "\"", "degr", "ee", "=\"_", "+_", "str_", "(_", "self_", "._", "degree_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "+=_", "\",", " ", "\"_", "+_", "Kernel_", "._", "\\u\\u", "str\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "+=_", "\"]\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Polynomial", "Kernel_", "(_", "Kernel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "kernel_", "(_", "self_", ",_", "X_", ",_", "Y_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Compute", "s", " ", "the", " ", "polynomial", " ", "kernel", " ", "k", "(", "x", ",", "y", ")=", "(", "1", "+", "theta", "*<", "x", ",", "y", ">)", "^", "degr", "ee", " ", "for", " ", "the", " ", "give", "n", " ", "data", "\\", "10", ";", " ", " ", " ", " ", "X", " ", "-", " ", "samples", " ", "on", " ", "right", " ", "hand", " ", "side", "\\", "10", ";", " ", " ", " ", " ", "Y", " ", "-", " ", "samples", " ", "on", " ", "left", " ", "hand", " ", "side", ",", " ", "can", " ", "be", " ", "Non", "e", " ", "in", " ", "whi", "ch", " ", "case", " ", "its", " ", "replaced", " ", "by", " ", "X", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "Y_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Y_", "=_", "X_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "pow_", "(_", "self_", "._", "theta_", "+_", "X_", "._", "dot_", "(_", "Y_", "._", "T_", ")_", ",_", "self_", "._", "degree_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Polynomial", "Kernel_", "(_", "Kernel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "gradient_", "(_", "self_", ",_", "x_", ",_", "Y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Compute", "s", " ", "the", " ", "gradi", "ent", " ", "of", " ", "the", " ", "Polynomial", " ", "kernel", " ", "wrt", ".", " ", "to", " ", "the", " ", "left", " ", "argu", "ment", ",", " ", "i", ".", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "\\\\", "nab", "la", "\\u", "x", " ", "k", "(", "x", ",", "y", ")=", "\\\\", "nab", "la", "\\u", "x", " ", "(", "1", "+", "x", "^", "Ty", ")", "^", "d", "=", "d", "(", "1", "+", "x", "^", "Ty", ")", "^", "(", "d", "-1", ")", " ", "y", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "x", " ", "-", " ", "single", " ", "sample", " ", "on", " ", "right", " ", "hand", " ", "side", " ", "(", "1", "D", " ", "vector", ")", "\\", "10", ";", " ", " ", " ", " ", "Y", " ", "-", " ", "samples", " ", "on", " ", "left", " ", "hand", " ", "side", " ", "(", "2", "D", " ", "matrix", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "len_", "(_", "x_", "._", "shape_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "len_", "(_", "Y_", "._", "shape_", ")_", "==_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "len_", "(_", "x_", ")_", "==_", "Y_", "._", "shape_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "degree_", "*_", "pow_", "(_", "1_", "+_", "x_", "._", "dot_", "(_", "Y_", "._", "T_", ")_", ",_", "self_", "._", "degree_", ")_", "*_", "Y_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
mahmoud/boltons/tests/test_gcutils.py
[ { "content": " def test_toggle_gc_postcollect():\n COUNT = int(1e6)\n\n start = time.time()\n with toggle_gc_postcollect:\n x = [{} for x in range(COUNT)]\n no_gc_time = time.time() - start\n\n start = time.time()\n x = [{} for x in range(COUNT)]\n with_gc_time = time.time() - start\n\n time_diff = no_gc_time < with_gc_time", "metadata": "root.test_toggle_gc_postcollect", "header": "['module', '___EOS___']", "index": 21 } ]
[ { "span": "x ", "start_line": 26, "start_column": 12, "end_line": 26, "end_column": 13 } ]
[]
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_", "test\\u", "toggle", "\\u", "gc", "\\u", "postc", "olle", "ct_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "COUNT_", "=_", "int_", "(_", "1e6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "start_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "toggle", "\\u", "gc", "\\u", "postc", "olle", "ct_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "[_", "{_", "}_", "for_", "x_", "in_", "range_", "(_", "COUNT_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "no", "\\u", "gc", "\\u", "time_", "=_", "time_", "._", "time_", "(_", ")_", "-_", "start_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "start_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "[_", "{_", "}_", "for_", "x_", "in_", "range_", "(_", "COUNT_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "gc", "\\u", "time_", "=_", "time_", "._", "time_", "(_", ")_", "-_", "start_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "time", "\\u", "diff_", "=_", "no", "\\u", "gc", "\\u", "time_", "<_", "with", "\\u", "gc", "\\u", "time_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
lambdalisue/django-permission/src/permission/templatetags/patch.py
[ { "content": "# vim: set fileencoding=utf-8 :\n\"\"\"\ndjango if templatetag patch\n\"\"\"\nimport django\n\n\nif django.VERSION < (1, 4):\n from django.template import Node\n from django.template import NodeList\n from django.template import VariableDoesNotExist\n from django.template import TemplateSyntaxError\n try:\n from django.template.base import TextNode\n except ImportError:\n from django.template import TextNode\n # copied from django 1.4b\n # copied from django 1.4b\nelse:\n from django.template.defaulttags import IfNode\n parser_patch = lambda instance: instance\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": " class IfNode(Node):", "metadata": "root.IfNode", "header": "['module', '___EOS___']", "index": 17 }, { "content": " def __init__(self, conditions_nodelists):\n self.conditions_nodelists = conditions_nodelists", "metadata": "root.IfNode.__init__", "header": "['class', 'IfNode', '(', 'Node', ')', ':', '___EOS___']", "index": 18 }, { "content": " def __repr__(self):\n return \"<IfNode>\"", "metadata": "root.IfNode.__repr__", "header": "['class', 'IfNode', '(', 'Node', ')', ':', '___EOS___']", "index": 20 }, { "content": " def __iter__(self):\n for _, nodelist in self.conditions_nodelists:\n for node in nodelist:\n yield node", "metadata": "root.IfNode.__iter__", "header": "['class', 'IfNode', '(', 'Node', ')', ':', '___EOS___']", "index": 22 }, { "content": " @property\n def nodelist(self):\n return NodeList(node for _, nodelist in self.conditions_nodelists for node in nodelist)", "metadata": "root.IfNode.nodelist", "header": "['class', 'IfNode', '(', 'Node', ')', ':', '___EOS___']", "index": 26 }, { "content": " def render(self, context):\n for condition, nodelist in self.conditions_nodelists:\n if condition is not None: # if / elif clause\n try:\n match = condition.eval(context)\n except VariableDoesNotExist:\n match = None\n else: # else clause\n match = True\n if match:\n return nodelist.render(context)\n return ''", "metadata": "root.IfNode.render", "header": "['class', 'IfNode', '(', 'Node', ')', ':', '___EOS___']", "index": 29 }, { "content": " def parse(self, parse_until=None):\n if parse_until is None:\n parse_until = []\n nodelist = self.create_nodelist()\n while self.tokens:\n token = self.next_token()\n # Use the raw values here for TOKEN_* for a tiny performance boost.\n if token.token_type == 0: # TOKEN_TEXT\n self.extend_nodelist(nodelist, TextNode(token.contents), token)\n elif token.token_type == 1: # TOKEN_VAR\n if not token.contents:\n self.empty_variable(token)\n filter_expression = self.compile_filter(token.contents)\n var_node = self.create_variable_node(filter_expression)\n self.extend_nodelist(nodelist, var_node, token)\n elif token.token_type == 2: # TOKEN_BLOCK\n try:\n command = token.contents.split()[0]\n except IndexError:\n self.empty_block_tag(token)\n if command in parse_until:\n # put token back on token list so calling\n # code knows why it terminated\n self.prepend_token(token)\n return nodelist\n # execute callback function for this tag and append\n # resulting node\n self.enter_command(command, token)\n try:\n compile_func = self.tags[command]\n except KeyError:\n self.invalid_block_tag(token, command, parse_until)\n try:\n compiled_result = compile_func(self, token)\n except TemplateSyntaxError as e:\n if not self.compile_function_error(token, e):\n raise\n self.extend_nodelist(nodelist, compiled_result, token)\n self.exit_command()\n if parse_until:\n self.unclosed_block_tag(parse_until)\n return nodelist", "metadata": "root.parse", "header": "['module', '___EOS___']", "index": 42 }, { "content": " def parser_patch(instance):\n instance.__class__.parse = parse\n return instance", "metadata": "root.parser_patch", "header": "['module', '___EOS___']", "index": 84 } ]
[ { "span": "from django.template.defaulttags import IfNode", "start_line": 88, "start_column": 4, "end_line": 88, "end_column": 50 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "vim", ":", " ", "set", " ", "file", "encoding", "=", "utf", "-", "8", " ", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "django", " ", "if", " ", "templatet", "ag", " ", "patch", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "django_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "django_", "._", "VERSION_", "<_", "(_", "1_", ",_", "4_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "django_", "._", "template_", "import_", "Node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "template_", "import_", "Node", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "template_", "import_", "Varia", "ble", "Do", "es", "Not", "Exist_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "template_", "import_", "Templa", "te", "Syntax", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "django_", "._", "template_", "._", "base_", "import_", "Text", "Node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "django_", "._", "template_", "import_", "Text", "Node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "copie", "d", " ", "from", " ", "django", " ", "1.4", "b_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "copie", "d", " ", "from", " ", "django", " ", "1.4", "b_", "\\u\\u\\uNL\\u\\u\\u_", "\\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 ", " _", "from_", "django_", "._", "template_", "._", "default", "tags_", "import_", "If", "Node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser", "\\u", "patch_", "=_", "lambda_", "instance_", ":_", "instance_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "If", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "If", "Node_", "(_", "Node_", ")_", ":_", "\\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_", ",_", "condition", "s", "\\u", "nodel", "ists", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "condition", "s", "\\u", "nodel", "ists", "_", "=_", "condition", "s", "\\u", "nodel", "ists", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "If", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\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_", "\"<", "If", "Node", ">\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "If", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "iter\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "\\u_", ",_", "nodelist_", "in_", "self_", "._", "condition", "s", "\\u", "nodel", "ists", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "node_", "in_", "nodelist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "yield_", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "If", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "nodelist_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Node", "List_", "(_", "node_", "for_", "\\u_", ",_", "nodelist_", "in_", "self_", "._", "condition", "s", "\\u", "nodel", "ists", "_", "for_", "node_", "in_", "nodelist_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "If", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "condition_", ",_", "nodelist_", "in_", "self_", "._", "condition", "s", "\\u", "nodel", "ists", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "condition_", "is_", "not_", "None_", ":_", "#", " ", "if", " ", "/", " ", "eli", "f", " ", "clause_", "\\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 ", " ", " _", "match_", "=_", "condition_", "._", "eval_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Varia", "ble", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "match_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "else", " ", "clause_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "match_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "nodelist_", "._", "render_", "(_", "context_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse_", "(_", "self_", ",_", "parse", "\\u", "until_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "parse", "\\u", "until_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parse", "\\u", "until_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "nodelist_", "=_", "self_", "._", "create", "\\u", "nodelist_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "self_", "._", "tokens_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "token_", "=_", "self_", "._", "next", "\\u", "token_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Us", "e", " ", "the", " ", "raw", " ", "values", " ", "here", " ", "for", " ", "TOKEN", "\\u*", " ", "for", " ", "a", " ", "tiny", " ", "perform", "anc", "e", " ", "boost", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "token_", "._", "token", "\\u", "type_", "==_", "0_", ":_", "#", " ", "TOKEN", "\\u", "TEXT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "extend", "\\u", "nodelist_", "(_", "nodelist_", ",_", "Text", "Node_", "(_", "token_", "._", "contents_", ")_", ",_", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "token_", "._", "token", "\\u", "type_", "==_", "1_", ":_", "#", " ", "TOKEN", "\\u", "VAR_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "token_", "._", "contents_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "empty", "\\u", "variable_", "(_", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "filter", "\\u", "expression_", "=_", "self_", "._", "compile", "\\u", "filter_", "(_", "token_", "._", "contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "var", "\\u", "node_", "=_", "self_", "._", "create", "\\u", "variab", "le", "\\u", "node_", "(_", "filter", "\\u", "expression_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "extend", "\\u", "nodelist_", "(_", "nodelist_", ",_", "var", "\\u", "node_", ",_", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "token_", "._", "token", "\\u", "type_", "==_", "2_", ":_", "#", " ", "TOKEN", "\\u", "BLOCK_", "\\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 ", " ", "_", "command_", "=_", "token_", "._", "contents_", "._", "split_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Index", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "empty", "\\u", "block", "\\u", "tag_", "(_", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "command_", "in_", "parse", "\\u", "until_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "put", " ", "token", " ", "back", " ", "on", " ", "token", " ", "list", " ", "so", " ", "calling", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "code", " ", "knows", " ", "wh", "y", " ", "it", " ", "terminate", "d_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "prepend", "\\u", "token_", "(_", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "nodelist_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "execute", " ", "callback", " ", "function", " ", "for", " ", "this", " ", "tag", " ", "and", " ", "append_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "result", "ing", " ", "node_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "enter", "\\u", "command_", "(_", "command_", ",_", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "compile", "\\u", "func_", "=_", "self_", "._", "tags_", "[_", "command_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "invalid", "\\u", "block", "\\u", "tag_", "(_", "token_", ",_", "command_", ",_", "parse", "\\u", "until_", ")_", "\\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 ", " ", "_", "compile", "d\\u", "result_", "=_", "compile", "\\u", "func_", "(_", "self_", ",_", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Templa", "te", "Syntax", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "not_", "self_", "._", "compile", "\\u", "function", "\\u", "error_", "(_", "token_", ",_", "e_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "extend", "\\u", "nodelist_", "(_", "nodelist_", ",_", "compile", "d\\u", "result_", ",_", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "exit", "\\u", "command_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "parse", "\\u", "until_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "uncl", "ose", "d\\u", "block", "\\u", "tag_", "(_", "parse", "\\u", "until_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "nodelist_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parser", "\\u", "patch_", "(_", "instance_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "instance_", "._", "\\u\\u", "class\\u\\u_", "._", "parse_", "=_", "parse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "instance_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2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, 2, 2, 2, 2, 2, 2 ]
Unused import
oleiade/etcaetera/etcaetera/adapter/file.py
[ { "content": "import os\nimport imp\n\nfrom etcaetera.adapter.base import Adapter\nfrom etcaetera.utils import format_key\nfrom etcaetera.constants import (\n JSON_EXTENSIONS,\n YAML_EXTENSIONS,\n PYTHON_EXTENSIONS\n)\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class File(Adapter):\n\n", "metadata": "root.File", "header": "['module', '___EOS___']", "index": 12 }, { "content": " def __init__(self, filepath, *args, **kwargs):\n self.filepath = filepath\n\n # If strict parameter (inherited from parent) is True,\n # strictness_check routine will be called\n super(File, self).__init__(*args, **kwargs)", "metadata": "root.File.__init__", "header": "['class', 'File', '(', 'Adapter', ')', ':', '___EOS___']", "index": 13 }, { "content": " def strictness_check(self):\n if not os.path.exists(self.filepath):\n raise IOError(\"Path {0} does not exist\".format(self.filepath))", "metadata": "root.File.strictness_check", "header": "['class', 'File', '(', 'Adapter', ')', ':', '___EOS___']", "index": 20 }, { "content": " def load(self, formatter=None):\n try:\n fd = open(self.filepath, 'r')\n except IOError:\n if self.strict is True:\n raise\n else:\n return\n\n _, file_extension = os.path.splitext(self.filepath)\n\n if file_extension.lower() in JSON_EXTENSIONS:\n import json\n self.data = dict((self.format(k, formatter), v) for k, v in json.load(fd).items())\n elif file_extension.lower() in YAML_EXTENSIONS:\n from yaml import load as yload, dump as ydump\n try:\n from yaml import CLoader as Loader\n except ImportError:\n from yaml import Loader\n self.data = dict((self.format(k, formatter), v) for k, v in yload(fd, Loader=Loader).items())\n elif file_extension.lower() in PYTHON_EXTENSIONS:\n mod = imp.load_source('mod', self.filepath)\n self.data = dict((self.format(k, formatter), v) for k, v in vars(mod).items() if k.isupper())\n else:\n raise ValueError(\"Unhandled file extension {0}\".format(file_extension))\n\n fd.close()", "metadata": "root.File.load", "header": "['class', 'File', '(', 'Adapter', ')', ':', '___EOS___']", "index": 24 } ]
[ { "span": "from etcaetera.utils import format_key", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 38 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "imp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "etc", "ae", "tera", "_", "._", "adapter_", "._", "base_", "import_", "Adapter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "etc", "ae", "tera", "_", "._", "utils_", "import_", "format\\u", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "etc", "ae", "tera", "_", "._", "constants_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "JSO", "N", "\\u", "EXTENSIONS_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "YAM", "L", "\\u", "EXTENSIONS_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "PYTHON", "\\u", "EXTENSIONS_", "\\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_", "File_", "(_", "Adapter_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "File_", "(_", "Adapter_", ")_", ":_", "\\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_", ",_", "filepath_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "filepath_", "=_", "filepath_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "strict", " ", "parameter", " ", "(", "inherited", " ", "from", " ", "parent", ")", " ", "is", " ", "Tru", "e", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "strict", "ness", "\\u", "check", " ", "routin", "e", " ", "will", " ", "be", " ", "called_", "\\u\\u\\uNL\\u\\u\\u_", "super_", "(_", "File_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "File_", "(_", "Adapter_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "strict", "ness", "\\u", "check_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "self_", "._", "filepath_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "IO", "Error_", "(_", "\"", "Path", " ", "{", "0", "}", " ", "doe", "s", " ", "not", " ", "exist", "\"_", "._", "format_", "(_", "self_", "._", "filepath_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "File_", "(_", "Adapter_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load_", "(_", "self_", ",_", "formatter_", "=_", "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 ", " _", "fd_", "=_", "open_", "(_", "self_", "._", "filepath_", ",_", "'", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "IO", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "strict_", "is_", "True_", ":_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u_", ",_", "file", "\\u", "extension_", "=_", "os_", "._", "path_", "._", "splitext_", "(_", "self_", "._", "filepath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "file", "\\u", "extension_", "._", "lower_", "(_", ")_", "in_", "JSO", "N", "\\u", "EXTENSIONS_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "data_", "=_", "dict_", "(_", "(_", "self_", "._", "format_", "(_", "k_", ",_", "formatter_", ")_", ",_", "v_", ")_", "for_", "k_", ",_", "v_", "in_", "json_", "._", "load_", "(_", "fd_", ")_", "._", "items_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "file", "\\u", "extension_", "._", "lower_", "(_", ")_", "in_", "YAM", "L", "\\u", "EXTENSIONS_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "yaml_", "import_", "load_", "as_", "ylo", "ad_", ",_", "dump_", "as_", "yd", "ump_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "yaml_", "import_", "CL", "oad", "er_", "as_", "Loader_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "yaml_", "import_", "Loader_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "data_", "=_", "dict_", "(_", "(_", "self_", "._", "format_", "(_", "k_", ",_", "formatter_", ")_", ",_", "v_", ")_", "for_", "k_", ",_", "v_", "in_", "ylo", "ad_", "(_", "fd_", ",_", "Loader_", "=_", "Loader_", ")_", "._", "items_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "file", "\\u", "extension_", "._", "lower_", "(_", ")_", "in_", "PYTHON", "\\u", "EXTENSIONS_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mod_", "=_", "imp_", "._", "load", "\\u", "source_", "(_", "'", "mod", "'_", ",_", "self_", "._", "filepath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "data_", "=_", "dict_", "(_", "(_", "self_", "._", "format_", "(_", "k_", ",_", "formatter_", ")_", ",_", "v_", ")_", "for_", "k_", ",_", "v_", "in_", "vars_", "(_", "mod_", ")_", "._", "items_", "(_", ")_", "if_", "k_", "._", "isupper", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Unh", "andle", "d", " ", "file", " ", "extensi", "on", " ", "{", "0", "}\"_", "._", "format_", "(_", "file", "\\u", "extension_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fd_", "._", "close_", "(_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 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 ]
Unused import
dimagi/commcare-hq/corehq/form_processor/migrations/0041_noop_specify_table_names.py
[ { "content": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Migration(migrations.Migration):\n\n dependencies = [\n ('form_processor', '0040_save_functions'),\n ]\n\n operations = [\n migrations.AlterModelTable(\n name='caseattachmentsql',\n table='form_processor_caseattachmentsql',\n ),\n migrations.AlterModelTable(\n name='casetransaction',\n table='form_processor_casetransaction',\n ),\n migrations.AlterModelTable(\n name='commcarecaseindexsql',\n table='form_processor_commcarecaseindexsql',\n ),\n migrations.AlterModelTable(\n name='commcarecasesql',\n table='form_processor_commcarecasesql',\n ),\n migrations.AlterModelTable(\n name='xformattachmentsql',\n table='form_processor_xformattachmentsql',\n ),\n migrations.AlterModelTable(\n name='xforminstancesql',\n table='form_processor_xforminstancesql',\n ),\n migrations.AlterModelTable(\n name='xformoperationsql',\n table='form_processor_xformoperationsql',\n ),\n ]", "metadata": "root.Migration", "header": "['module', '___EOS___']", "index": 6 } ]
[ { "span": "from django.db import models, migrations", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 40 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", ",_", "migrations_", "\\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_", "(_", "migrations_", "._", "Migration_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dependencies_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "form", "\\u", "process", "or", "'_", ",_", "'", "0040", "\\u", "save", "\\u", "function", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "operations_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "migrations_", "._", "Alter", "Model", "Table_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "case", "attach", "ment", "sql", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "table_", "=_", "'", "form", "\\u", "process", "or", "\\u", "case", "attach", "ment", "sql", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "migrations_", "._", "Alter", "Model", "Table_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "case", "transaction", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "table_", "=_", "'", "form", "\\u", "process", "or", "\\u", "case", "transaction", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "migrations_", "._", "Alter", "Model", "Table_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "comm", "care", "case", "index", "sql", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "table_", "=_", "'", "form", "\\u", "process", "or", "\\u", "comm", "care", "case", "index", "sql", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "migrations_", "._", "Alter", "Model", "Table_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "comm", "care", "case", "sql", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "table_", "=_", "'", "form", "\\u", "process", "or", "\\u", "comm", "care", "case", "sql", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "migrations_", "._", "Alter", "Model", "Table_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "xform", "attach", "ment", "sql", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "table_", "=_", "'", "form", "\\u", "process", "or", "\\u", "xform", "attach", "ment", "sql", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "migrations_", "._", "Alter", "Model", "Table_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "xform", "instance", "sql", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "table_", "=_", "'", "form", "\\u", "process", "or", "\\u", "xform", "instance", "sql", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "migrations_", "._", "Alter", "Model", "Table_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "xform", "operati", "ons", "ql", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "table_", "=_", "'", "form", "\\u", "process", "or", "\\u", "xform", "operati", "ons", "ql", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_" ]
[ 4, 4, 4, 4, 4, 2, 2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################################################################\n#\n# The MIT License (MIT)\n#\n# Copyright (c) Tavendo GmbH\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###############################################################################\n\nimport sys\nimport os\nimport pkg_resources\nimport StringIO\nfrom sys import argv, executable\nfrom socket import AF_INET\n\n# make sure we run a capable OS/reactor\n##\nstartupMsgs = []\nif 'bsd' in sys.platform:\n from twisted.internet import kqreactor\n kqreactor.install()\n startupMsgs.append(\"Alrighty: you run a capable kqueue platform - good job!\")\nelif sys.platform.startswith('linux'):\n from twisted.internet import epollreactor\n epollreactor.install()\n startupMsgs.append(\"Alrighty: you run a capable epoll platform - good job!\")\nelif sys.platform.startswith('darwin'):\n from twisted.internet import kqreactor\n kqreactor.install()\n startupMsgs.append(\"Huh, you run OSX and have kqueue, but don't be disappointed when performance sucks;)\")\nelif sys.platform == 'win32':\n raise Exception(\"Sorry dude, Twisted/Windows select/iocp reactors lack the necessary bits.\")\nelse:\n raise Exception(\"Hey man, what OS are you using?\")\n\nfrom twisted.internet import reactor\n\nstartupMsgs.append(\"Using Twisted reactor class %s on Twisted %s\" % (str(reactor.__class__), pkg_resources.require(\"Twisted\")[0].version))\n\n\nfrom twisted.internet import reactor\nfrom twisted.python import log\nfrom twisted.internet import reactor\nfrom twisted.internet.protocol import Factory\nfrom twisted.web.server import Site\nfrom twisted.web.static import File\n\nfrom autobahn.websocket.util import parse_url\n\nfrom autobahn.twisted.websocket import WebSocketServerFactory, \\\n WebSocketServerProtocol\n\nfrom autobahn.util import Stopwatch\n\n\nhasStatprof = False\ntry:\n import statprof\n startupMsgs.append(\"statprof found! you may enable statistical profiling\")\n hasStatprof = True\nexcept ImportError:\n startupMsgs.append(\"statprof not installed - no profiling available\")\n\n\n\n\n\n\n\n\n# export PYPYLOG=\"jit-log-opt,jit-backend:pypy.log\"\n\n# Run under \"perf\" and enable PyPy JIT logging\n##\n# Notes:\n##\n# - setting an env var (outside root) will NOT work (not propagated)\n# - setting in code also will NOT work\n##\n# sudo PYPYLOG=\"jit-log-opt,jit-backend:pypy.log\" perf record ~/pypy-20131102/bin/pypy server.py --workers 4\n\n\n\n\nPROFILER_FREQ = 2000\n\n\n\n# /usr/include/valgrind/valgrind.h\n# valgrind --tool=callgrind python server.py --wsuri ws://127.0.0.1:9000\n\n# http://valgrind.org/docs/manual/cg-manual.html\n# http://valgrind.org/docs/manual/cl-manual.html\n\n# https://bitbucket.org/pypy/jitviewer\n# http://morepypy.blogspot.de/2011/08/visualization-of-jitted-code.html\n# http://people.cs.uct.ac.za/~tmullins/work/writeup.pdf\n\n# list(range(psutil.NUM_CPUS))\n# p.get_cpu_affinity()\n\n# p.set_cpu_affinity([0])\n# p.set_nice(psutil.HIGH_PRIORITY_CLASS)\n\n\nif __name__ == '__main__':\n\n import argparse\n import psutil\n\n DEFAULT_WORKERS = psutil.cpu_count()\n\n parser = argparse.ArgumentParser(description='Autobahn WebSocket Echo Multicore Server')\n parser.add_argument('--wsuri', dest='wsuri', type=str, default=u'ws://127.0.0.1:9000', help='The WebSocket URI the server is listening on, e.g. ws://localhost:9000.')\n parser.add_argument('--port', dest='port', type=int, default=8080, help='Port to listen on for embedded Web server. Set to 0 to disable.')\n parser.add_argument('--workers', dest='workers', type=int, default=DEFAULT_WORKERS, help='Number of workers to spawn - should fit the number of (physical) CPU cores.')\n parser.add_argument('--noaffinity', dest='noaffinity', action=\"store_true\", default=False, help='Do not set worker/CPU affinity.')\n parser.add_argument('--backlog', dest='backlog', type=int, default=8192, help='TCP accept queue depth. You must tune your OS also as this is just advisory!')\n parser.add_argument('--silence', dest='silence', action=\"store_true\", default=False, help='Silence log output.')\n parser.add_argument('--debug', dest='debug', action=\"store_true\", default=False, help='Enable WebSocket debug output.')\n parser.add_argument('--interval', dest='interval', type=int, default=5, help='Worker stats update interval.')\n parser.add_argument('--profile', dest='profile', action=\"store_true\", default=False, help='Enable profiling.')\n\n parser.add_argument('--fd', dest='fd', type=int, default=None, help='If given, this is a worker which will use provided FD and all other options are ignored.')\n parser.add_argument('--cpuid', dest='cpuid', type=int, default=None, help='If given, this is a worker which will use provided CPU core to set its affinity.')\n\n options = parser.parse_args()\n\n if options.profile and not hasStatprof:\n raise Exception(\"profiling requested, but statprof not installed\")\n\n # parse WS URI into components and forward via options\n # FIXME: add TLS support\n isSecure, host, wsport, resource, path, params = parse_url(options.wsuri)\n options.wsport = wsport\n\n # if not options.silence:\n # log.startLogging(sys.stdout)\n\n if options.fd is not None:\n # run worker\n worker(options)\n else:\n if not options.silence:\n for m in startupMsgs:\n print m\n # run master\n master(options)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Stats:\n\n\n\n\n\n\n", "metadata": "root.Stats", "header": "['module', '___EOS___']", "index": 82 }, { "content": " def __init__(self):\n # stats period\n self.period = 0\n\n # currently connected client\n self.clients = 0\n\n # total (running) stats\n self.tMsgs = 0\n self.tOctets = 0\n self.tHandshakes = 0\n self.tOctetsWireIn = 0\n self.tOctetsWireOut = 0\n\n self.stopwatch = Stopwatch(start=False)\n\n # period stats\n self._advance()", "metadata": "root.Stats.__init__", "header": "['class', 'Stats', ':', '___EOS___']", "index": 84 }, { "content": " def _advance(self):\n self.period += 1\n self.pMsgs = 0\n self.pOctets = 0\n self.pHandshakes = 0\n self.pOctetsWireIn = 0\n self.pOctetsWireOut = 0\n self.stopwatch.resume()", "metadata": "root.Stats._advance", "header": "['class', 'Stats', ':', '___EOS___']", "index": 103 }, { "content": " def trackHandshake(self):\n self.tHandshakes += 1\n self.pHandshakes += 1", "metadata": "root.Stats.trackHandshake", "header": "['class', 'Stats', ':', '___EOS___']", "index": 112 }, { "content": " def trackMsg(self, length):\n self.tMsgs += 1\n self.pMsgs += 1\n self.tOctets += length\n self.pOctets += length", "metadata": "root.Stats.trackMsg", "header": "['class', 'Stats', ':', '___EOS___']", "index": 116 }, { "content": " def trackOctetsWireIn(self, count):\n self.tOctetsWireIn += count\n self.pOctetsWireIn += count", "metadata": "root.Stats.trackOctetsWireIn", "header": "['class', 'Stats', ':', '___EOS___']", "index": 122 }, { "content": " def trackOctetsWireOut(self, count):\n self.tOctetsWireOut += count\n self.pOctetsWireOut += count", "metadata": "root.Stats.trackOctetsWireOut", "header": "['class', 'Stats', ':', '___EOS___']", "index": 126 }, { "content": " def stats(self, advance=True):\n elapsed = self.stopwatch.stop()\n\n s = (\"Period No. : %d\\n\" +\n \"Period duration : %.3f s\\n\" +\n \"Connected clients : %d\\n\" +\n \"\\n\" +\n\n \"Period\\n\" +\n \" Handshakes : %20d # %20d #/s\\n\" +\n \" Echo'ed msgs : %20d # %20d #/s\\n\" +\n \" Echo'ed octets : %20d B %20d B/s\\n\" +\n \" Wire octets in : %20d B %20d B/s\\n\" +\n \" Wire octets out : %20d B %20d B/s\\n\" +\n \"\\n\" +\n\n \"Total\\n\" +\n \" Handshakes : %20d #\\n\" +\n \" Echo'ed msgs : %20d #\\n\" +\n \" Echo'ed octets : %20d B\\n\" +\n \" Wire octets in : %20d B\\n\" +\n \" Wire octets out : %20d B\\n\" +\n\n \"\"\n ) % (self.period,\n round(elapsed, 3),\n self.clients,\n\n self.pHandshakes,\n round(float(self.pHandshakes) / elapsed),\n\n self.pMsgs,\n round(float(self.pMsgs) / elapsed),\n\n self.pOctets,\n round(float(self.pOctets) / elapsed),\n\n self.pOctetsWireIn,\n round(float(self.pOctetsWireIn) / elapsed),\n\n self.pOctetsWireOut,\n round(float(self.pOctetsWireOut) / elapsed),\n\n self.tHandshakes,\n self.tMsgs,\n self.tOctets,\n self.tOctetsWireIn,\n self.tOctetsWireOut,\n )\n self._advance()\n return s", "metadata": "root.Stats.stats", "header": "['class', 'Stats', ':', '___EOS___']", "index": 130 }, { "content": "class EchoServerProtocol(WebSocketServerProtocol):\n\n\n\n", "metadata": "root.EchoServerProtocol", "header": "['module', '___EOS___']", "index": 183 }, { "content": " def onOpen(self):\n self.factory.stats.clients += 1\n self.factory.stats.trackHandshake()", "metadata": "root.EchoServerProtocol.onOpen", "header": "['class', 'EchoServerProtocol', '(', 'WebSocketServerProtocol', ')', ':', '___EOS___']", "index": 185 }, { "content": " def onMessage(self, msg, binary):\n self.sendMessage(msg, binary)\n self.factory.stats.trackMsg(len(msg))", "metadata": "root.EchoServerProtocol.onMessage", "header": "['class', 'EchoServerProtocol', '(', 'WebSocketServerProtocol', ')', ':', '___EOS___']", "index": 189 }, { "content": " def onClose(self, wasClean, code, reason):\n self.factory.stats.clients -= 1", "metadata": "root.EchoServerProtocol.onClose", "header": "['class', 'EchoServerProtocol', '(', 'WebSocketServerProtocol', ')', ':', '___EOS___']", "index": 193 }, { "content": " def connectionLost(self, reason):\n WebSocketServerProtocol.connectionLost(self, reason)\n\n self.factory.stats.trackOctetsWireIn(self.trafficStats.preopenIncomingOctetsWireLevel +\n self.trafficStats.incomingOctetsWireLevel)\n\n self.factory.stats.trackOctetsWireOut(self.trafficStats.preopenOutgoingOctetsWireLevel +\n self.trafficStats.outgoingOctetsWireLevel)", "metadata": "root.EchoServerProtocol.connectionLost", "header": "['class', 'EchoServerProtocol', '(', 'WebSocketServerProtocol', ')', ':', '___EOS___']", "index": 196 }, { "content": "class EchoServerFactory(WebSocketServerFactory):\n\n protocol = EchoServerProtocol\n", "metadata": "root.EchoServerFactory", "header": "['module', '___EOS___']", "index": 206 }, { "content": " def __init__(self, wsuri):\n WebSocketServerFactory.__init__(self, wsuri)\n self.stats = Stats()", "metadata": "root.EchoServerFactory.__init__", "header": "['class', 'EchoServerFactory', '(', 'WebSocketServerFactory', ')', ':', '___EOS___']", "index": 210 }, { "content": "def master(options):\n \"\"\"\n Start of the master process.\n \"\"\"\n if not options.silence:\n print \"Master started on PID %s\" % os.getpid()\n\n # start embedded Web server if asked for (this only runs on master)\n ##\n if options.port:\n webdir = File(\".\")\n web = Site(webdir)\n web.log = lambda _: None # disable annoyingly verbose request logging\n reactor.listenTCP(options.port, web)\n\n # we just need some factory like thing .. it won't be used on master anyway\n # for actual socket accept\n ##\n factory = Factory()\n\n # create socket, bind and listen ..\n port = reactor.listenTCP(options.wsport, factory, backlog=options.backlog)\n\n # .. but immediately stop reading: we only want to accept on workers, not master\n port.stopReading()\n\n # fire off background workers\n ##\n for i in range(options.workers):\n\n args = [executable, \"-u\", __file__, \"--fd\", str(port.fileno()), \"--cpuid\", str(i)]\n\n # pass on cmd line args to worker ..\n args.extend(sys.argv[1:])\n\n reactor.spawnProcess(\n None, executable, args,\n childFDs={0: 0, 1: 1, 2: 2, port.fileno(): port.fileno()},\n env=os.environ)\n\n reactor.run()", "metadata": "root.master", "header": "['module', '___EOS___']", "index": 227 }, { "content": "def worker(options):\n \"\"\"\n Start background worker process.\n \"\"\"\n workerPid = os.getpid()\n\n if not options.noaffinity:\n p = psutil.Process(workerPid)\n print \"affinity [before]\", p.cpu_affinity()\n p.cpu_affinity([options.cpuid])\n print \"affinity [after]\", p.cpu_affinity()\n\n factory = EchoServerFactory(options.wsuri)\n\n # The master already created the socket, just start listening and accepting\n ##\n reactor.adoptStreamPort(options.fd, AF_INET, factory)\n\n if not options.silence:\n print \"Worker started on PID %s using factory %s and protocol %s\" % (workerPid, factory, factory.protocol)\n # print \"Worker %d PYPYLOG=%s\" % (workerPid, os.environ.get('PYPYLOG', None))\n\n if options.profile:\n statprof.reset(PROFILER_FREQ)\n statprof.start()\n\n if not options.silence:\n def stat():\n if options.profile:\n statprof.stop()\n\n output = StringIO.StringIO()\n output.write(\"-\" * 80 + \"\\n\")\n output.write(\"Worker Statistics (PID %s)\\n\\n%s\" % (workerPid, factory.stats.stats()))\n\n if options.profile:\n output.write(\"\\n\")\n # format = statprof.DisplayFormats.ByLine\n # format = statprof.DisplayFormats.ByMethod\n # statprof.display(output, format = format)\n statprof.display(output)\n\n output.write(\"-\" * 80 + \"\\n\\n\")\n\n sys.stdout.write(output.getvalue())\n\n if options.profile:\n statprof.reset(PROFILER_FREQ)\n statprof.start()\n\n reactor.callLater(options.interval, stat)\n\n reactor.callLater(options.interval, stat)\n\n if False:\n import cProfile\n print \"RUNNING cProfile\"\n cProfile.run('reactor.run()')\n else:\n reactor.run()", "metadata": "root.worker", "header": "['module', '___EOS___']", "index": 273 } ]
[ { "span": "from sys import argv, executable", "start_line": 30, "start_column": 0, "end_line": 30, "end_column": 32 }, { "span": "from twisted.python import log", "start_line": 59, "start_column": 0, "end_line": 59, "end_column": 30 } ]
[]
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_", "#", " ", "The", " ", "MIT", " ", "License", " ", "(", "MIT", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "Ta", "vend", "o", " ", "Gm", "b", "H_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Permi", "ssion", " ", "is", " ", "here", "by", " ", "grant", "ed", ",", " ", "free", " ", "of", " ", "charge", ",", " ", "to", " ", "any", " ", "person", " ", "obtain", "ing", " ", "a", " ", "copy_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "this", " ", "software", " ", "and", " ", "associate", "d", " ", "documentation", " ", "files", " ", "(", "the", " ", "\"", "Sof", "twa", "re", "\")", ",", " ", "to", " ", "deal", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "the", " ", "Sof", "twa", "re", " ", "with", "out", " ", "restriction", ",", " ", "inclu", "ding", " ", "with", "out", " ", "limit", "ation", " ", "the", " ", "rights_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "use", ",", " ", "copy", ",", " ", "modif", "y", ",", " ", "merge", ",", " ", "publi", "sh", ",", " ", "distribute", ",", " ", "subli", "cens", "e", ",", " ", "and", "/", "or", " ", "sell", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "copie", "s", " ", "of", " ", "the", " ", "Sof", "twa", "re", ",", " ", "and", " ", "to", " ", "permit", " ", "person", "s", " ", "to", " ", "who", "m", " ", "the", " ", "Sof", "twa", "re", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fur", "nish", "ed", " ", "to", " ", "do", " ", "so", ",", " ", "subject", " ", "to", " ", "the", " ", "follow", "ing", " ", "condition", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "above", " ", "copyr", "ight", " ", "notice", " ", "and", " ", "this", " ", "permissi", "on", " ", "notice", " ", "sha", "ll", " ", "be", " ", "include", "d", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "all", " ", "copie", "s", " ", "or", " ", "substa", "nti", "al", " ", "porti", "ons", " ", "of", " ", "the", " ", "Sof", "twa", "re", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THE", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "\"", "AS", " ", "IS", "\",", " ", "WITH", "OUT", " ", "WAR", "RAN", "TY", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "EXPR", "ESS", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "IMPL", "IED", ",", " ", "INC", "LU", "DING", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", " ", "THE", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "AND", " ", "NON", "INF", "RING", "EME", "NT", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "AUTHOR", "S", " ", "OR", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "CLA", "IM", ",", " ", "DA", "MAGE", "S", " ", "OR", " ", "OTHER", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "AN", " ", "ACTI", "ON", " ", "OF", " ", "CONTR", "ACT", ",", " ", "TOR", "T", " ", "OR", " ", "OTHER", "WI", "SE", ",", " ", "ARI", "SIN", "G", " ", "FROM", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "OUT", " ", "OF", " ", "OR", " ", "IN", " ", "CONNECTION", " ", "WITH", " ", "THE", " ", "SOFT", "WARE", " ", "OR", " ", "THE", " ", "USE", " ", "OR", " ", "OTHER", " ", "DEA", "LING", "S", " ", "IN_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THE", " ", "SOFT", "WARE", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pkg", "\\u", "resources_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sys_", "import_", "argv_", ",_", "executable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "socket_", "import_", "AF", "\\u", "INET_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "sure", " ", "we", " ", "run", " ", "a", " ", "capable", " ", "OS", "/", "reactor_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "start", "up", "Msg", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "bsd", "'_", "in_", "sys_", "._", "platform_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "twisted_", "._", "internet_", "import_", "kq", "reactor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kq", "reactor_", "._", "install_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "up", "Msg", "s_", "._", "append_", "(_", "\"", "Al", "right", "y", ":", " ", "you", " ", "run", " ", "a", " ", "capable", " ", "kq", "ueue", " ", "platform", " ", "-", " ", "good", " ", "job", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "sys_", "._", "platform_", "._", "startswith_", "(_", "'", "linux", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "twisted_", "._", "internet_", "import_", "epo", "ll", "reactor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "epo", "ll", "reactor_", "._", "install_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "up", "Msg", "s_", "._", "append_", "(_", "\"", "Al", "right", "y", ":", " ", "you", " ", "run", " ", "a", " ", "capable", " ", "epo", "ll", " ", "platform", " ", "-", " ", "good", " ", "job", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "sys_", "._", "platform_", "._", "startswith_", "(_", "'", "dar", "win", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "twisted_", "._", "internet_", "import_", "kq", "reactor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kq", "reactor_", "._", "install_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "up", "Msg", "s_", "._", "append_", "(_", "\"", "Hu", "h", ",", " ", "you", " ", "run", " ", "OSX", " ", "and", " ", "have", " ", "kq", "ueue", ",", " ", "but", " ", "don", "'", "t", " ", "be", " ", "disapp", "oint", "ed", " ", "whe", "n", " ", "perform", "anc", "e", " ", "suc", "ks", ";)", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "sys_", "._", "platform_", "==_", "'", "win32", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "So", "rr", "y", " ", "dud", "e", ",", " ", "Twi", "sted", "/", "Window", "s", " ", "select", "/", "ioc", "p", " ", "react", "ors", " ", "lack", " ", "the", " ", "necessar", "y", " ", "bits", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "He", "y", " ", "man", ",", " ", "what", " ", "OS", " ", "are", " ", "you", " ", "usi", "ng", "?\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "twisted_", "._", "internet_", "import_", "reactor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "start", "up", "Msg", "s_", "._", "append_", "(_", "\"", "Us", "ing", " ", "Twi", "sted", " ", "react", "or", " ", "class", " ", "%", "s", " ", "on", " ", "Twi", "sted", " ", "%", "s", "\"_", "%_", "(_", "str_", "(_", "reactor_", "._", "\\u\\u", "class\\u\\u_", ")_", ",_", "pkg", "\\u", "resources_", "._", "require_", "(_", "\"", "Twi", "sted", "\"_", ")_", "[_", "0_", "]_", "._", "version_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "twisted_", "._", "internet_", "import_", "reactor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "twisted_", "._", "python_", "import_", "log_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "twisted_", "._", "internet_", "import_", "reactor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "twisted_", "._", "internet_", "._", "protocol_", "import_", "Factory_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "twisted_", "._", "web_", "._", "server_", "import_", "Site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "twisted_", "._", "web_", "._", "static_", "import_", "File_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "autob", "ah", "n_", "._", "websocket_", "._", "util_", "import_", "parse", "\\u", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "autob", "ah", "n_", "._", "twisted_", "._", "websocket_", "import_", "Web", "Sock", "et", "Server", "Factory_", ",_", "Web", "Sock", "et", "Server", "Protocol_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "autob", "ah", "n_", "._", "util_", "import_", "Sto", "pw", "atch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "has", "Stat", "prof_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "stat", "prof_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "up", "Msg", "s_", "._", "append_", "(_", "\"", "stat", "prof", " ", "found", "!", " ", "you", " ", "may", " ", "enable", " ", "statistic", "al", " ", "profiling", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "has", "Stat", "prof_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "up", "Msg", "s_", "._", "append_", "(_", "\"", "stat", "prof", " ", "not", " ", "install", "ed", " ", "-", " ", "no", " ", "profiling", " ", "avail", "able", "\"_", ")_", "\\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_", "#", " ", "export", " ", "PY", "PY", "LOG", "=\"", "jit", "-", "log", "-", "opt", ",", "jit", "-", "back", "end", ":", "pypy", ".", "log", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Run", " ", "under", " ", "\"", "perf", "\"", " ", "and", " ", "enable", " ", "Py", "Py", " ", "JI", "T", " ", "logging_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "es", ":_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "setti", "ng", " ", "an", " ", "env", " ", "var", " ", "(", "outsi", "de", " ", "root", ")", " ", "will", " ", "NOT", " ", "work", " ", "(", "not", " ", "propagate", "d", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "setti", "ng", " ", "in", " ", "code", " ", "als", "o", " ", "will", " ", "NOT", " ", "work_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sudo", " ", "PY", "PY", "LOG", "=\"", "jit", "-", "log", "-", "opt", ",", "jit", "-", "back", "end", ":", "pypy", ".", "log", "\"", " ", "perf", " ", "record", " ", "~", "/", "pypy", "-", "2013", "1102", "/", "bin", "/", "pypy", " ", "server", ".", "py", " ", "--", "worker", "s", " ", "4_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "PROFILE", "R", "\\u", "FREQ", "_", "=_", "2000_", "\\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_", "#", " ", "/", "usr", "/", "include", "/", "val", "grind", "/", "val", "grind", ".", "h_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "val", "grind", " ", "--", "tool", "=", "call", "grind", " ", "python", " ", "server", ".", "py", " ", "--", "ws", "uri", " ", "ws", "://", "127", ".0", ".0", ".1", ":", "9000", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "val", "grind", ".", "org", "/", "docs", "/", "manu", "al", "/", "cg", "-", "manu", "al", ".", "html_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "val", "grind", ".", "org", "/", "docs", "/", "manu", "al", "/", "cl", "-", "manu", "al", ".", "html_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "https", "://", "bitb", "ucket", ".", "org", "/", "pypy", "/", "jit", "viewer_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "more", "pypy", ".", "blogs", "pot", ".", "de", "/", "2011", "/", "0", "8", "/", "visualization", "-", "of", "-", "jit", "ted", "-", "code", ".", "html_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "people", ".", "cs", ".", "uct", ".", "ac", ".", "za", "/", "~", "tm", "ull", "ins", "/", "work", "/", "write", "up", ".", "pdf_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "list", "(", "range", "(", "psu", "til", ".", "NUM", "\\u", "CPU", "S", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "p", ".", "get", "\\u", "cpu", "\\u", "affinity", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "p", ".", "set\\u", "cpu", "\\u", "affinity", "([", "0", "])", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "p", ".", "set\\u", "nice", "(", "psu", "til", ".", "HIGH", "\\u", "PRIORITY", "\\u", "CLASS", ")_", "\\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_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "argparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "psutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "WORKER", "S_", "=_", "psutil_", "._", "cpu", "\\u", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "=_", "argparse_", "._", "Arg", "ument", "Parser_", "(_", "description_", "=_", "'", "Auto", "bah", "n", " ", "Web", "Sock", "et", " ", "Ech", "o", " ", "Multi", "core", " ", "Server", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "ws", "uri", "'_", ",_", "dest_", "=_", "'", "ws", "uri", "'_", ",_", "type_", "=_", "str_", ",_", "default_", "=_", "u", "'", "ws", "://", "127", ".0", ".0", ".1", ":", "9000", "'_", ",_", "help_", "=_", "'", "The", " ", "Web", "Sock", "et", " ", "URI", " ", "the", " ", "server", " ", "is", " ", "listen", "ing", " ", "on", ",", " ", "e", ".", "g", ".", " ", "ws", "://", "local", "host", ":", "9000", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "port", "'_", ",_", "dest_", "=_", "'", "port", "'_", ",_", "type_", "=_", "int_", ",_", "default_", "=_", "8080_", ",_", "help_", "=_", "'", "Port", " ", "to", " ", "listen", " ", "on", " ", "for", " ", "embedde", "d", " ", "Web", " ", "server", ".", " ", "Set", " ", "to", " ", "0", " ", "to", " ", "disable", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "worker", "s", "'_", ",_", "dest_", "=_", "'", "worker", "s", "'_", ",_", "type_", "=_", "int_", ",_", "default_", "=_", "DEF", "AUL", "T", "\\u", "WORKER", "S_", ",_", "help_", "=_", "'", "Number", " ", "of", " ", "worker", "s", " ", "to", " ", "spawn", " ", "-", " ", "shou", "ld", " ", "fit", " ", "the", " ", "number", " ", "of", " ", "(", "physical", ")", " ", "CPU", " ", "cores", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "noa", "ffi", "nit", "y", "'_", ",_", "dest_", "=_", "'", "noa", "ffi", "nit", "y", "'_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ",_", "default_", "=_", "False_", ",_", "help_", "=_", "'", "Do", " ", "not", " ", "set", " ", "worker", "/", "CPU", " ", "affinity", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "backlog", "'_", ",_", "dest_", "=_", "'", "backlog", "'_", ",_", "type_", "=_", "int_", ",_", "default_", "=_", "8192_", ",_", "help_", "=_", "'", "TC", "P", " ", "accept", " ", "queue", " ", "depth", ".", " ", "You", " ", "must", " ", "tune", " ", "your", " ", "OS", " ", "als", "o", " ", "as", " ", "this", " ", "is", " ", "just", " ", "advisor", "y", "!'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "silence", "'_", ",_", "dest_", "=_", "'", "silence", "'_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ",_", "default_", "=_", "False_", ",_", "help_", "=_", "'", "Sile", "nce", " ", "log", " ", "output", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "debug", "'_", ",_", "dest_", "=_", "'", "debug", "'_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ",_", "default_", "=_", "False_", ",_", "help_", "=_", "'", "Enable", " ", "Web", "Sock", "et", " ", "debug", " ", "output", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "interval", "'_", ",_", "dest_", "=_", "'", "interval", "'_", ",_", "type_", "=_", "int_", ",_", "default_", "=_", "5_", ",_", "help_", "=_", "'", "Worke", "r", " ", "stats", " ", "update", " ", "interval", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "profile", "'_", ",_", "dest_", "=_", "'", "profile", "'_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ",_", "default_", "=_", "False_", ",_", "help_", "=_", "'", "Enable", " ", "profiling", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "fd", "'_", ",_", "dest_", "=_", "'", "fd", "'_", ",_", "type_", "=_", "int_", ",_", "default_", "=_", "None_", ",_", "help_", "=_", "'", "If", " ", "give", "n", ",", " ", "this", " ", "is", " ", "a", " ", "worker", " ", "whi", "ch", " ", "will", " ", "use", " ", "provided", " ", "FD", " ", "and", " ", "all", " ", "other", " ", "options", " ", "are", " ", "ignore", "d", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "cpui", "d", "'_", ",_", "dest_", "=_", "'", "cpui", "d", "'_", ",_", "type_", "=_", "int_", ",_", "default_", "=_", "None_", ",_", "help_", "=_", "'", "If", " ", "give", "n", ",", " ", "this", " ", "is", " ", "a", " ", "worker", " ", "whi", "ch", " ", "will", " ", "use", " ", "provided", " ", "CPU", " ", "core", " ", "to", " ", "set", " ", "its", " ", "affinity", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "=_", "parser_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "options_", "._", "profile_", "and_", "not_", "has", "Stat", "prof_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "profiling", " ", "request", "ed", ",", " ", "but", " ", "stat", "prof", " ", "not", " ", "install", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "parse", " ", "WS", " ", "URI", " ", "int", "o", " ", "component", "s", " ", "and", " ", "forward", " ", "via", " ", "options_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIX", "ME", ":", " ", "add", " ", "TLS", " ", "support_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "is", "Secur", "e_", ",_", "host_", ",_", "wsp", "ort_", ",_", "resource_", ",_", "path_", ",_", "params_", "=_", "parse", "\\u", "url_", "(_", "options_", "._", "ws", "uri_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "._", "wsp", "ort_", "=_", "wsp", "ort_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "not", " ", "options", ".", "silence", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "log", ".", "start", "Log", "ging", "(", "sys", ".", "stdout", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "options_", "._", "fd_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "run", " ", "worker_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "worker_", "(_", "options_", ")_", "\\u\\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_", "options_", "._", "silence", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "m_", "in_", "start", "up", "Msg", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "run", " ", "master_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "master_", "(_", "options_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Stats_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Stats_", ":_", "\\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_", "#", " ", "stats", " ", "period_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "period_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "currentl", "y", " ", "connect", "ed", " ", "client_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "clients_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "total", " ", "(", "runn", "ing", ")", " ", "stats_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "t", "Msg", "s_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "t", "Octet", "s_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "t", "Handsha", "kes", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "t", "Octet", "s", "Wire", "In_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "t", "Octet", "s", "Wire", "Out_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "stop", "watch_", "=_", "Sto", "pw", "atch_", "(_", "start_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "period", " ", "stats_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "advance_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stats_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "advance_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "period_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "p", "Msg", "s_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "p", "Octet", "s_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "p", "Handsha", "kes", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "p", "Octet", "s", "Wire", "In_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "p", "Octet", "s", "Wire", "Out_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stop", "watch_", "._", "resume_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stats_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "track", "Handsha", "ke_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "t", "Handsha", "kes", "_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "p", "Handsha", "kes", "_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stats_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "track", "Msg_", "(_", "self_", ",_", "length_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "t", "Msg", "s_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "p", "Msg", "s_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "t", "Octet", "s_", "+=_", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "p", "Octet", "s_", "+=_", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stats_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "track", "Octet", "s", "Wire", "In_", "(_", "self_", ",_", "count_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "t", "Octet", "s", "Wire", "In_", "+=_", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "p", "Octet", "s", "Wire", "In_", "+=_", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stats_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "track", "Octet", "s", "Wire", "Out_", "(_", "self_", ",_", "count_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "t", "Octet", "s", "Wire", "Out_", "+=_", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "p", "Octet", "s", "Wire", "Out_", "+=_", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stats_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "stats_", "(_", "self_", ",_", "advance_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "elapsed_", "=_", "self_", "._", "stop", "watch_", "._", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "(_", "\"", "Period", " ", "No", ".", " ", " ", " ", " ", ":", " ", "%", "d", "\\\\", "n", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Period", " ", "duration", " ", " ", " ", ":", " ", "%", ".3", "f", " ", "s", "\\\\", "n", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Connect", "ed", " ", "clients", " ", ":", " ", "%", "d", "\\\\", "n", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"\\\\", "n", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Period", "\\\\", "n", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", "Handsha", "kes", " ", " ", ":", " ", "%", "20", "d", " ", "#", " ", "%", "20", "d", " ", "#", "/", "s", "\\\\", "n", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", "Ech", "o", "'", "ed", " ", "msgs", " ", " ", " ", " ", ":", " ", "%", "20", "d", " ", "#", " ", "%", "20", "d", " ", "#", "/", "s", "\\\\", "n", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", "Ech", "o", "'", "ed", " ", "octets", " ", " ", ":", " ", "%", "20", "d", " ", "B", " ", "%", "20", "d", " ", "B", "/", "s", "\\\\", "n", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", "Wire", " ", "octets", " ", "in", " ", " ", ":", " ", "%", "20", "d", " ", "B", " ", "%", "20", "d", " ", "B", "/", "s", "\\\\", "n", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", "Wire", " ", "octets", " ", "out", " ", ":", " ", "%", "20", "d", " ", "B", " ", "%", "20", "d", " ", "B", "/", "s", "\\\\", "n", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"\\\\", "n", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Total", "\\\\", "n", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", "Handsha", "kes", " ", " ", ":", " ", "%", "20", "d", " ", "#", "\\\\", "n", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", "Ech", "o", "'", "ed", " ", "msgs", " ", " ", " ", " ", ":", " ", "%", "20", "d", " ", "#", "\\\\", "n", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", "Ech", "o", "'", "ed", " ", "octets", " ", " ", ":", " ", "%", "20", "d", " ", "B", "\\\\", "n", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", "Wire", " ", "octets", " ", "in", " ", " ", ":", " ", "%", "20", "d", " ", "B", "\\\\", "n", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", "Wire", " ", "octets", " ", "out", " ", ":", " ", "%", "20", "d", " ", "B", "\\\\", "n", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "%_", "(_", "self_", "._", "period_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "round_", "(_", "elapsed_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "clients_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "p", "Handsha", "kes", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "round_", "(_", "float_", "(_", "self_", "._", "p", "Handsha", "kes", "_", ")_", "/_", "elapsed_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "p", "Msg", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "round_", "(_", "float_", "(_", "self_", "._", "p", "Msg", "s_", ")_", "/_", "elapsed_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "p", "Octet", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "round_", "(_", "float_", "(_", "self_", "._", "p", "Octet", "s_", ")_", "/_", "elapsed_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "p", "Octet", "s", "Wire", "In_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "round_", "(_", "float_", "(_", "self_", "._", "p", "Octet", "s", "Wire", "In_", ")_", "/_", "elapsed_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "p", "Octet", "s", "Wire", "Out_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "round_", "(_", "float_", "(_", "self_", "._", "p", "Octet", "s", "Wire", "Out_", ")_", "/_", "elapsed_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "t", "Handsha", "kes", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "t", "Msg", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "t", "Octet", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "t", "Octet", "s", "Wire", "In_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "t", "Octet", "s", "Wire", "Out_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "advance_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Ech", "o", "Server", "Protocol_", "(_", "Web", "Sock", "et", "Server", "Protocol_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Ech", "o", "Server", "Protocol_", "(_", "Web", "Sock", "et", "Server", "Protocol_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "on", "Open_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "factory_", "._", "stats_", "._", "clients_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "factory_", "._", "stats_", "._", "track", "Handsha", "ke_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ech", "o", "Server", "Protocol_", "(_", "Web", "Sock", "et", "Server", "Protocol_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "Message_", "(_", "self_", ",_", "msg_", ",_", "binary_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "send", "Message_", "(_", "msg_", ",_", "binary_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "factory_", "._", "stats_", "._", "track", "Msg_", "(_", "len_", "(_", "msg_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ech", "o", "Server", "Protocol_", "(_", "Web", "Sock", "et", "Server", "Protocol_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "Close_", "(_", "self_", ",_", "was", "Clean", "_", ",_", "code_", ",_", "reason_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "factory_", "._", "stats_", "._", "clients_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ech", "o", "Server", "Protocol_", "(_", "Web", "Sock", "et", "Server", "Protocol_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "connecti", "on", "Lost", "_", "(_", "self_", ",_", "reason_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Web", "Sock", "et", "Server", "Protocol_", "._", "connecti", "on", "Lost", "_", "(_", "self_", ",_", "reason_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "factory_", "._", "stats_", "._", "track", "Octet", "s", "Wire", "In_", "(_", "self_", "._", "traffic", "Stats_", "._", "pre", "open", "Inco", "ming", "Octet", "s", "Wire", "Level_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "traffic", "Stats_", "._", "inco", "ming", "Octet", "s", "Wire", "Level_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "factory_", "._", "stats_", "._", "track", "Octet", "s", "Wire", "Out_", "(_", "self_", "._", "traffic", "Stats_", "._", "pre", "open", "Out", "goi", "ng", "Octet", "s", "Wire", "Level_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "traffic", "Stats_", "._", "outgoing", "Octet", "s", "Wire", "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_", "class_", "Ech", "o", "Server", "Factory_", "(_", "Web", "Sock", "et", "Server", "Factory_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "protocol_", "=_", "Ech", "o", "Server", "Protocol_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Ech", "o", "Server", "Factory_", "(_", "Web", "Sock", "et", "Server", "Factory_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "ws", "uri_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Web", "Sock", "et", "Server", "Factory_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "ws", "uri_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stats_", "=_", "Stats_", "(_", ")_", "\\u\\u\\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_", "master_", "(_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Start", " ", "of", " ", "the", " ", "master", " ", "process", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "options_", "._", "silence", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Master", " ", "start", "ed", " ", "on", " ", "PID", " ", "%", "s", "\"_", "%_", "os_", "._", "getpid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "start", " ", "embedde", "d", " ", "Web", " ", "server", " ", "if", " ", "ask", "ed", " ", "for", " ", "(", "this", " ", "only", " ", "runs", " ", "on", " ", "master", ")_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "options_", "._", "port_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "webd", "ir_", "=_", "File_", "(_", "\".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "web_", "=_", "Site_", "(_", "webd", "ir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "web_", "._", "log_", "=_", "lambda_", "\\u_", ":_", "None_", "#", " ", "disable", " ", "anno", "ying", "ly", " ", "verbo", "se", " ", "request", " ", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reactor_", "._", "listen", "TCP_", "(_", "options_", "._", "port_", ",_", "web_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "just", " ", "need", " ", "some", " ", "factor", "y", " ", "like", " ", "thing", " ", "..", " ", "it", " ", "won", "'", "t", " ", "be", " ", "used", " ", "on", " ", "master", " ", "anyway", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "actual", " ", "socket", " ", "accept_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "factory_", "=_", "Factory_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "socket", ",", " ", "bind", " ", "and", " ", "listen", " ", "..", "_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "reactor_", "._", "listen", "TCP_", "(_", "options_", "._", "wsp", "ort_", ",_", "factory_", ",_", "backlog", "_", "=_", "options_", "._", "backlog", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "..", " ", "but", " ", "immediate", "ly", " ", "stop", " ", "readi", "ng", ":", " ", "we", " ", "only", " ", "want", " ", "to", " ", "accept", " ", "on", " ", "worker", "s", ",", " ", "not", " ", "master_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "._", "stop", "Reading", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fire", " ", "off", " ", "background", " ", "workers_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "options_", "._", "workers_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "=_", "[_", "executable_", ",_", "\"-", "u", "\"_", ",_", "\\u\\u", "file\\u\\u_", ",_", "\"--", "fd", "\"_", ",_", "str_", "(_", "port_", "._", "fileno_", "(_", ")_", ")_", ",_", "\"--", "cpui", "d", "\"_", ",_", "str_", "(_", "i_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pass", " ", "on", " ", "cmd", " ", "line", " ", "args", " ", "to", " ", "worker", " ", "..", "_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "._", "extend_", "(_", "sys_", "._", "argv_", "[_", "1_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reactor_", "._", "spawn", "Process_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "executable_", ",_", "args_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "child", "FD", "s_", "=_", "{_", "0_", ":_", "0_", ",_", "1_", ":_", "1_", ",_", "2_", ":_", "2_", ",_", "port_", "._", "fileno_", "(_", ")_", ":_", "port_", "._", "fileno_", "(_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "env_", "=_", "os_", "._", "environ_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "reactor_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "worker_", "(_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Start", " ", "background", " ", "worker", " ", "process", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "worker", "Pid", "_", "=_", "os_", "._", "getpid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "options_", "._", "noa", "ffi", "nit", "y_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "psutil_", "._", "Process_", "(_", "worker", "Pid", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "affinity", " ", "[", "bef", "ore", "]\"_", ",_", "p_", "._", "cpu", "\\u", "affinity", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "cpu", "\\u", "affinity", "_", "(_", "[_", "options_", "._", "cpui", "d_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "affinity", " ", "[", "after", "]\"_", ",_", "p_", "._", "cpu", "\\u", "affinity", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "factory_", "=_", "Ech", "o", "Server", "Factory_", "(_", "options_", "._", "ws", "uri_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "master", " ", "alr", "ead", "y", " ", "created", " ", "the", " ", "socket", ",", " ", "just", " ", "start", " ", "listen", "ing", " ", "and", " ", "accept", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "reactor_", "._", "adopt", "Stream", "Port_", "(_", "options_", "._", "fd_", ",_", "AF", "\\u", "INET_", ",_", "factory_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "options_", "._", "silence", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Worke", "r", " ", "start", "ed", " ", "on", " ", "PID", " ", "%", "s", " ", "usi", "ng", " ", "factor", "y", " ", "%", "s", " ", "and", " ", "protoc", "ol", " ", "%", "s", "\"_", "%_", "(_", "worker", "Pid", "_", ",_", "factory_", ",_", "factory_", "._", "protocol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", " ", "\"", "Worke", "r", " ", "%", "d", " ", "PY", "PY", "LOG", "=", "%", "s", "\"", " ", "%", " ", "(", "worker", "Pid", ",", " ", "os", ".", "environ", ".", "get", "('", "PY", "PY", "LOG", "',", " ", "Non", "e", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "options_", "._", "profile_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stat", "prof_", "._", "reset_", "(_", "PROFILE", "R", "\\u", "FREQ", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stat", "prof_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "options_", "._", "silence", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "stat_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "options_", "._", "profile_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stat", "prof_", "._", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "output_", "=_", "String", "IO_", "._", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "._", "write_", "(_", "\"-\"_", "*_", "80_", "+_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "._", "write_", "(_", "\"", "Worke", "r", " ", "Statistic", "s", " ", "(", "PID", " ", "%", "s", ")\\\\", "n", "\\\\", "n", "%", "s", "\"_", "%_", "(_", "worker", "Pid", "_", ",_", "factory_", "._", "stats_", "._", "stats_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "options_", "._", "profile_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output_", "._", "write_", "(_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "format", " ", "=", " ", "stat", "prof", ".", "Display", "Format", "s", ".", "By", "Line_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "format", " ", "=", " ", "stat", "prof", ".", "Display", "Format", "s", ".", "By", "Method_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "stat", "prof", ".", "display", "(", "output", ",", " ", "format", " ", "=", " ", "format", ")_", "\\u\\u\\uNL\\u\\u\\u_", "stat", "prof_", "._", "display_", "(_", "output_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "output_", "._", "write_", "(_", "\"-\"_", "*_", "80_", "+_", "\"\\\\", "n", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sys_", "._", "stdout_", "._", "write_", "(_", "output_", "._", "getvalue_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "options_", "._", "profile_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stat", "prof_", "._", "reset_", "(_", "PROFILE", "R", "\\u", "FREQ", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stat", "prof_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "reactor_", "._", "call", "Later_", "(_", "options_", "._", "interval_", ",_", "stat_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "reactor_", "._", "call", "Later_", "(_", "options_", "._", "interval_", ",_", "stat_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "c", "Profile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "RUNN", "ING", " ", "c", "Profil", "e", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c", "Profile_", "._", "run_", "(_", "'", "react", "or", ".", "run", "()'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reactor_", "._", "run_", "(_", ")_", "\\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,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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 ]
Except block handles 'BaseException'
goFrendiAsgard/kokoropy/kokoropy/packages/alembic/operations.py
[ { "content": "from contextlib import contextmanager\n\nfrom sqlalchemy.types import NULLTYPE, Integer\nfrom sqlalchemy import schema as sa_schema\n\nfrom . import util\nfrom .compat import string_types\nfrom .ddl import impl\n\n__all__ = ('Operations',)\n\ntry:\n from sqlalchemy.sql.naming import conv\nexcept:\n conv = None\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "except:", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 7 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "contextlib_", "import_", "contextmanager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "sqlalchemy_", "._", "types_", "import_", "NULL", "TYPE_", ",_", "Integer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sqlalchemy_", "import_", "schema_", "as_", "sa", "\\u", "schema_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "import_", "util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "compat_", "import_", "string", "\\u", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "ddl", "_", "import_", "impl_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "(_", "'", "Opera", "tion", "s", "'_", ",_", ")_", "\\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_", "sqlalchemy_", "._", "sql_", "._", "naming_", "import_", "conv_", "\\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 ", " _", "conv_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
CountZer0/PipelineConstructionSet/python/maya/core/mayaCore.py
[ { "content": " def listcP(self, nodeWplug, quiet=0, all=0): #@ReservedAssignment\n \"\"\"\n SYNOPSIS\n Simple wrapper for listConnetions w/ plug\n\n INPUTS\n (PyNode.attr) mtNodeWPlug: The metaNode.plug to look at connections.\n (bool)\t\t\t\tquiet:\t 1 = suppress warning\n (bool) \t\t\t all:\t Return all connections\n\n RETURNS: (PyNode) connected node via plug\n \"\"\"\n try:\n if listConnections(nodeWplug):\n allConnections = listConnections(nodeWplug)\n if all:\n return map(lambda x: PyNode(x), allConnections)\n return PyNode(allConnections[0])\n except:\n if not quiet:\n self.logger.warning(\"Nothing connected to '%s'\" % nodeWplug)\n return 0", "metadata": "root.MayaMiscCore.listcP", "header": "['class', 'MayaMiscCore', '(', 'Maya', ')', ':', '___NEWLINE___', '##################################################################################################################################', '___NL___', '##\\tGeneric methods\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t##', '___NL___', '##################################################################################################################################', '___NL___', '___EOS___']", "index": 693 }, { "content": " @staticmethod\n def removeNameSpace(ns, nuke=0):\n\n # parse ns\n parentNS, childNS = ns.split(':')\n\n # create new children NS\n if childNS not in namespaceInfo(lon=1):\n Namespace.create(childNS)\n\n namespace(set=':') #@UndefinedVariable\n if nuke:\n childNS = ':'\n namespace(mv=(ns, childNS), f=1) #@UndefinedVariable\n\n # delete it\n Namespace(ns).remove()\n\n try:\n # try to remove parent if it is not part of another child namespace\n nss = listNamespaces(recursive=True, internal=False)\n if not [ns for ns in nss if re.search('%s:' % parentNS, ns)]:\n Namespace(parentNS).clean()\n Namespace(parentNS).remove()\n except:\n pass # still stuff in it", "metadata": "root.MayaNamespaceCore.removeNameSpace", "header": "['class', 'MayaNamespaceCore', '(', 'Maya', ')', ':', '___NEWLINE___', '##################################################################################################################################', '___NL___', '##\\tNamespace methods\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t##', '___NL___', '##################################################################################################################################', '___NL___', '___EOS___']", "index": 1038 }, { "content": " def lockVisibleAttrs(self, node):\n \"\"\"\n SYNOPSIS\n Locks all keyable attributes on the input node.\n\n INPUTS\n (string) node: The node to lock keyable attributes on.\n\n RETURNS: Nothing.\n \"\"\"\n\n if not len(ls(node)):\n self.logger.error(\"lockVisibleAttrs: input node does not exist '%s'.\\n\" % node)\n node = self.convertToPyNode(node)\n\n keyableAttrs = node.listAttr(k=1)\n if keyableAttrs:\n for kAttr in keyableAttrs:\n try:\n kAttr.lock()\n except:\n pass", "metadata": "root.MayaVisibilityCore.lockVisibleAttrs", "header": "['class', 'MayaVisibilityCore', '(', 'Maya', ')', ':', '___NEWLINE___', '##################################################################################################################', '___NL___', '##\\tVisibility methods\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t##', '___NL___', '##################################################################################################################', '___NL___', '___EOS___']", "index": 1372 }, { "content": " def unlockVisibleAttrs(self, node):\n \"\"\"\n SYNOPSIS\n Locks all keyable attributes on the input node.\n\n INPUTS\n (string) node: The node to lock keyable attributes on.\n\n RETURNS: Nothing.\n \"\"\"\n node = self.convertToPyNode(node)\n\n keyableAttrs = node.listAttr(k=1)\n if keyableAttrs:\n for kAttr in keyableAttrs:\n try:\n kAttr.unlock()\n except:\n pass", "metadata": "root.MayaVisibilityCore.unlockVisibleAttrs", "header": "['class', 'MayaVisibilityCore', '(', 'Maya', ')', ':', '___NEWLINE___', '##################################################################################################################', '___NL___', '##\\tVisibility methods\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t##', '___NL___', '##################################################################################################################', '___NL___', '___EOS___']", "index": 1395 }, { "content": " def checkHier4Mesh(self, metaRoot):\n \"\"\"\n NAME: checkHier4Mesh\n\n SYNOPSIS\n Check main hierarchy to see if any joint has a 'mesh' (poly)\n shape node parented to it. This will break the granny exporter\n\n INPUTS\n (string) \tmetaRoot:\tmetaRoot PyNode\n\n RETURNS: (list) [result, [offending]]\n \"\"\"\n\n offending = []\n result = [0, 0]\n\n if objExists(metaRoot):\n metaRoot = self.convertToPyNode(metaRoot)\n rootJoint = self.listcP(metaRoot.rootJoint)\n if rootJoint:\n for child in rootJoint.getChildren(ad=1):\n try:\n if objectType(child) == 'mesh':\n if child.getParent().attr('type').get() == 5: #ball joints\n offending.append(child)\n except:\n pass # pymel erros on checking objectType of effectors?\n\n if offending:\n result = [1, offending]\n select(offending, r=1)\n\n return result", "metadata": "root.MayaMeshCore.checkHier4Mesh", "header": "['class', 'MayaMeshCore', '(', 'Maya', ')', ':', '___NEWLINE___', '##################################################################################################################################', '___NL___', '##\\tMesh methods\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t##', '___NL___', '##################################################################################################################################', '___NL___', '___EOS___']", "index": 1426 } ]
[ { "span": "except:", "start_line": 711, "start_column": 8, "end_line": 711, "end_column": 15 }, { "span": "except:", "start_line": 1062, "start_column": 8, "end_line": 1062, "end_column": 15 }, { "span": "except:", "start_line": 1392, "start_column": 16, "end_line": 1392, "end_column": 23 }, { "span": "except:", "start_line": 1412, "start_column": 16, "end_line": 1412, "end_column": 23 }, { "span": "except:", "start_line": 1452, "start_column": 20, "end_line": 1452, "end_column": 27 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Maya", "Mis", "c", "Core_", "(_", "Maya", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", "\t", "Gene", "ric", " ", "method", "s", "\t\t\t\t\t\t\t\t\t\t\t", "\t\t\t\t\t\t\t\t\t\t\t", "\t\t\t", "\t\t\t", "##", "_", "\\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_", "list", "c", "P_", "(_", "self_", ",_", "node", "Wp", "lug", "_", ",_", "quiet_", "=_", "0_", ",_", "all_", "=_", "0_", ")_", ":_", "#@", "Reserve", "d", "Assignment_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "SYN", "OPS", "IS", "\\", "10", ";", " ", " ", " ", " ", " ", "Simple", " ", "wrapp", "er", " ", "for", " ", "list", "Con", "neti", "ons", " ", "w", "/", " ", "plug", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "INPUT", "S", "\\", "10", ";", " ", " ", " ", " ", " ", "(", "Py", "Node", ".", "attr", ")", " ", "mt", "Node", "WP", "lug", ":", " ", " ", "The", " ", "meta", "Node", ".", "plug", " ", "to", " ", "look", " ", "at", " ", "connections", ".", "\\", "10", ";", " ", " ", " ", " ", " ", "(", "bool", ")", "\t\t\t", "\t", "quie", "t", ":", "\t", " ", "1", " ", "=", " ", "suppress", " ", "warn", "ing", "\\", "10", ";", " ", " ", " ", " ", " ", "(", "bool", ")", " \t\t", "\t", " ", " ", "all", ":", "\t", " ", "Return", " ", "all", " ", "connections", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "RETURN", "S", ":", " ", "(", "Py", "Node", ")", " ", " ", "connect", "ed", " ", "node", " ", "via", " ", "plug", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "list", "Connections_", "(_", "node", "Wp", "lug", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "all", "Connections_", "=_", "list", "Connections_", "(_", "node", "Wp", "lug", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "all_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "map_", "(_", "lambda_", "x_", ":_", "Py", "Node_", "(_", "x_", ")_", ",_", "all", "Connections_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Py", "Node_", "(_", "all", "Connections_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "quiet_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "._", "warning_", "(_", "\"", "Not", "hing", " ", "connect", "ed", " ", "to", " ", "'%", "s", "'\"_", "%_", "node", "Wp", "lug", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Maya", "Names", "pace", "Core_", "(_", "Maya", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", "\t", "Names", "pace", " ", "method", "s", "\t\t\t\t\t\t\t\t\t\t\t", "\t\t\t\t\t\t\t\t\t\t\t", "\t\t\t", "\t\t\t", "##", "_", "\\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_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "remove", "Name", "Space_", "(_", "ns_", ",_", "nuk", "e_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "parse", " ", "ns_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parent", "NS_", ",_", "child", "NS_", "=_", "ns_", "._", "split_", "(_", "':'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "new", " ", "child", "ren", " ", "NS_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "child", "NS_", "not_", "in_", "namespace", "Info_", "(_", "lon_", "=_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Namespace_", "._", "create_", "(_", "child", "NS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "namespace_", "(_", "set_", "=_", "':'_", ")_", "#@", "Unde", "fined", "Variable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "nuk", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "child", "NS_", "=_", "':'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "namespace_", "(_", "mv_", "=_", "(_", "ns_", ",_", "child", "NS_", ")_", ",_", "f_", "=_", "1_", ")_", "#@", "Unde", "fined", "Variable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "delete", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "Namespace_", "(_", "ns_", ")_", "._", "remove_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "try", " ", "to", " ", "remove", " ", "parent", " ", "if", " ", "it", " ", "is", " ", "not", " ", "part", " ", "of", " ", "anot", "her", " ", "child", " ", "namespace_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nss", "_", "=_", "list", "Names", "paces", "_", "(_", "recursive_", "=_", "True_", ",_", "internal_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "[_", "ns_", "for_", "ns_", "in_", "nss", "_", "if_", "re_", "._", "search_", "(_", "'%", "s", ":'_", "%_", "parent", "NS_", ",_", "ns_", ")_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Namespace_", "(_", "parent", "NS_", ")_", "._", "clean_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Namespace_", "(_", "parent", "NS_", ")_", "._", "remove_", "(_", ")_", "\\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_", "#", " ", "still", " ", "stu", "ff", " ", "in", " ", "it_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Maya", "Vis", "ibi", "lit", "y", "Core_", "(_", "Maya", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", "\t", "Vis", "ibi", "lit", "y", " ", "method", "s", "\t\t\t\t\t\t\t\t\t\t\t", "\t\t\t\t\t\t\t\t\t\t\t", "\t", "##", "_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "lock", "Vis", "ibl", "e", "Attrs_", "(_", "self_", ",_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "SYN", "OPS", "IS", "\\", "10", ";", " ", " ", " ", " ", " ", "Lock", "s", " ", "all", " ", "key", "able", " ", "attribute", "s", " ", "on", " ", "the", " ", "input", " ", "node", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "INPUT", "S", "\\", "10", ";", " ", " ", " ", " ", " ", "(", "string", ")", " ", "node", ":", " ", " ", "The", " ", "node", " ", "to", " ", "lock", " ", "key", "able", " ", "attribute", "s", " ", "on", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "RETURN", "S", ":", " ", "Not", "hing", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "len_", "(_", "ls_", "(_", "node_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "._", "error_", "(_", "\"", "lock", "Vis", "ibl", "e", "Attr", "s", ":", " ", "input", " ", "node", " ", "doe", "s", " ", "not", " ", "exist", " ", "'%", "s", "'.", "\\\\", "n", "\"_", "%_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "node_", "=_", "self_", "._", "convert", "To", "Py", "Node_", "(_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "key", "able", "Attrs_", "=_", "node_", "._", "list", "Attr_", "(_", "k_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "key", "able", "Attrs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "k", "Attr_", "in_", "key", "able", "Attrs_", ":_", "\\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 ", " ", "_", "k", "Attr_", "._", "lock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Maya", "Vis", "ibi", "lit", "y", "Core_", "(_", "Maya", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", "\t", "Vis", "ibi", "lit", "y", " ", "method", "s", "\t\t\t\t\t\t\t\t\t\t\t", "\t\t\t\t\t\t\t\t\t\t\t", "\t", "##", "_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "unlock", "Vis", "ibl", "e", "Attrs_", "(_", "self_", ",_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "SYN", "OPS", "IS", "\\", "10", ";", " ", " ", " ", " ", " ", "Lock", "s", " ", "all", " ", "key", "able", " ", "attribute", "s", " ", "on", " ", "the", " ", "input", " ", "node", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "INPUT", "S", "\\", "10", ";", " ", " ", " ", " ", " ", "(", "string", ")", " ", "node", ":", " ", " ", "The", " ", "node", " ", "to", " ", "lock", " ", "key", "able", " ", "attribute", "s", " ", "on", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "RETURN", "S", ":", " ", "Not", "hing", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "=_", "self_", "._", "convert", "To", "Py", "Node_", "(_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "key", "able", "Attrs_", "=_", "node_", "._", "list", "Attr_", "(_", "k_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "key", "able", "Attrs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "k", "Attr_", "in_", "key", "able", "Attrs_", ":_", "\\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 ", " ", "_", "k", "Attr_", "._", "unlock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Maya", "Mesh", "Core_", "(_", "Maya", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", "\t", "Mesh", " ", "method", "s", "\t\t\t\t\t\t\t\t\t\t\t", "\t\t\t\t\t\t\t\t\t\t\t", "\t\t\t", "\t\t\t", "##", "_", "\\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_", "check", "Hier", "4", "Mesh_", "(_", "self_", ",_", "meta", "Root_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "NAME", ":", " ", "check", "Hier", "4", "Mesh", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "SYN", "OPS", "IS", "\\", "10", ";", " ", " ", " ", " ", " ", "Check", " ", "main", " ", "hier", "arch", "y", " ", "to", " ", "see", " ", "if", " ", "any", " ", "joint", " ", "has", " ", "a", " ", "'", "mesh", "'", " ", "(", "poly", ")", "\\", "10", ";", " ", " ", " ", " ", " ", "shape", " ", "node", " ", "parent", "ed", " ", "to", " ", "it", ".", " ", "Thi", "s", " ", "will", " ", "break", " ", "the", " ", "gran", "ny", " ", "exporter", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "INPUT", "S", "\\", "10", ";", " ", " ", " ", " ", " ", "(", "string", ")", " ", "\t", "meta", "Roo", "t", ":", "\t", "meta", "Roo", "t", " ", "Py", "Node", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "RETURN", "S", ":", " ", "(", "list", ")", " ", "[", "result", ",", " ", "[", "offen", "ding", "]]", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "offen", "ding_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "[_", "0_", ",_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "obj", "Exists_", "(_", "meta", "Root_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "meta", "Root_", "=_", "self_", "._", "convert", "To", "Py", "Node_", "(_", "meta", "Root_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Joint", "_", "=_", "self_", "._", "list", "c", "P_", "(_", "meta", "Root_", "._", "root", "Joint", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "root", "Joint", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "child_", "in_", "root", "Joint", "_", "._", "get", "Children_", "(_", "ad_", "=_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "object", "Type_", "(_", "child_", ")_", "==_", "'", "mesh", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "child_", "._", "get", "Parent_", "(_", ")_", "._", "attr_", "(_", "'", "type", "'_", ")_", "._", "get_", "(_", ")_", "==_", "5_", ":_", "#", "bal", "l", " ", "joints_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "offen", "ding_", "._", "append_", "(_", "child_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "#", " ", "pym", "el", " ", "erro", "s", " ", "on", " ", "checking", " ", "object", "Type", " ", "of", " ", "effect", "ors", "?", "_", "\\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_", "if_", "offen", "ding_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "[_", "1_", ",_", "offen", "ding_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "select_", "(_", "offen", "ding_", ",_", "r_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 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,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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, 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 ]
Module is imported with 'import' and 'import from'
lobocv/pyperform/examples/imports.py
[ { "content": "@ComparisonBenchmark('imports', timeit_repeat=10)\ndef import_top_level():\n import os\n import datetime\n import collections\n import json", "metadata": "root.import_top_level", "header": "['module', '___EOS___']", "index": 6 } ]
[ { "span": "import os", "start_line": 8, "start_column": 4, "end_line": 8, "end_column": 13 }, { "span": "import datetime", "start_line": 9, "start_column": 4, "end_line": 9, "end_column": 19 }, { "span": "import collections", "start_line": 10, "start_column": 4, "end_line": 10, "end_column": 22 }, { "span": "import json", "start_line": 11, "start_column": 4, "end_line": 11, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Module_", "is_", "imported_", "with_", "'", "import", "'_", "and_", "'", "import", " ", "from", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "Compari", "son", "Benchmark", "_", "(_", "'", "import", "s", "'_", ",_", "time", "it", "\\u", "repeat_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "import", "\\u", "top", "\\u", "level_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "collections_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\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, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2 ]
Implicit string concatenation in a list
rizar/attention-lvcsr/libs/Theano/theano/sandbox/gpuarray/nnet.py
[ { "content": " def gpu_kernels(self, node, nodename):\n dtype_x = node.inputs[0].dtype\n dtype_sm = node.outputs[0].dtype\n load_x = load_w(dtype_x)\n write_sm = write_w(node.outputs[0].dtype)\n work_sm = work_dtype(dtype_sm)\n flags = Kernel.get_flags(dtype_x, dtype_sm)\n type_x = gpuarray.dtype_to_ctype(dtype_x)\n type_sm = gpuarray.dtype_to_ctype(dtype_sm)\n type_acc = gpuarray.dtype_to_ctype(work_sm)\n params = [\n 'uintp', 'uintp',\n gpuarray.GpuArray, 'uintp', 'intp', 'intp',\n gpuarray.GpuArray, 'uintp', 'intp', 'intp'\n ]\n kernels = []\n kname = \"kSoftmax\"\n k_var = \"kSoftmax_\" + nodename\n code = nvcc_kernel(\n kname,\n params=['const ga_size M', 'const ga_size N',\n 'const %s * x' % type_x, 'const ga_size offset_x',\n 'const ga_ssize sx0', 'const ga_ssize sx1',\n '%s * sm' % type_sm, 'const ga_size offset_sm',\n 'const ga_ssize sm_s0', 'const ga_ssize sm_s1'],\n body=[\"extern __shared__ %s buf[]\" % type_acc,\n \"%s * buf2 = buf + N\" % type_acc,\n \"x = (const %s *)(((char *)x)+offset_x)\" % type_x,\n \"sm = (%s *)(((char *)sm)+offset_sm)\" % type_sm,\n \"for (int blockIDX = blockIdx.x; blockIDX < M;\"\n \" blockIDX += gridDim.x){\",\n \"for (int tx = threadIdx.x; tx< N; tx += blockDim.x){\",\n \"buf[tx] = %s(x[blockIDX * sx0 + tx * sx1])\" % load_x,\n \"buf2[tx] = buf[tx]\",\n \"}\",\n \"__syncthreads()\",\n inline_softmax('N', 'buf', 'buf2', 'threadIdx.x',\n 'blockDim.x', dtype=work_sm),\n \"for (int tx = threadIdx.x; tx< N; tx += blockDim.x){\",\n # This set all value correctly\n \"sm[blockIDX * sm_s0 + tx * sm_s1] = %s(buf[tx])\" % write_sm,\n \"}\",\n \"__syncthreads()\",\n \"}\",\n ])\n kernels.append(Kernel(code=code, name=kname, params=params,\n flags=flags, objvar=k_var))\n kname = \"kSoftmax_fixed_shared\"\n k_var = \"kSoftmax_fixed_shared\" + nodename\n code = nvcc_kernel(\n kname,\n params=['const ga_size M', 'const ga_size N',\n 'const %s * x' % type_x, 'const ga_size offset_x',\n 'const ga_ssize sx0', 'const ga_ssize sx1',\n '%s * sm' % type_sm, 'const ga_size offset_sm',\n 'const ga_ssize sm_s0', 'const ga_ssize sm_s1'],\n body=[\"extern __shared__ %s buf[]\" % type_acc,\n \"x = (const %s *)(((char *)x)+offset_x)\" % type_x,\n \"sm = (%s *)(((char *)sm)+offset_sm)\" % type_sm,\n \"for (int blockIDX = blockIdx.x; blockIDX < M;\"\n \" blockIDX += gridDim.x){\",\n \"const %s *x_ptr = &x[blockIDX * sx0]\" % type_x,\n \"%s *sm_ptr = &sm[blockIDX * sm_s0]\" % type_sm,\n inline_softmax_fixed_shared('N', 'buf', 'x_ptr', 'sx1',\n load_x,\n 'sm_ptr', 'sm_s1', write_sm,\n 'threadIdx.x', 'blockDim.x',\n dtype=work_sm),\n \"__syncthreads()\",\n \"}\",\n ])\n kernels.append(Kernel(code=code, name=kname, params=params,\n flags=flags, objvar=k_var))\n return kernels", "metadata": "root.GpuSoftmax.gpu_kernels", "header": "['class', 'GpuSoftmax', '(', 'GpuKernelBase', ',', 'Op', ')', ':', '___EOS___']", "index": 678 }, { "content": " def gpu_kernels(self, node, nodename):\n dtype_x = node.inputs[0].dtype\n dtype_b = node.inputs[1].dtype\n dtype_sm = node.outputs[0].dtype\n load_x = load_w(node.inputs[0].dtype)\n load_b = load_w(node.inputs[1].dtype)\n write_sm = write_w(node.outputs[0].dtype)\n work_sm = work_dtype(node.outputs[0].dtype)\n flags = Kernel.get_flags(dtype_x, dtype_b, dtype_sm)\n type_x = gpuarray.dtype_to_ctype(dtype_x)\n type_b = gpuarray.dtype_to_ctype(dtype_b)\n type_sm = gpuarray.dtype_to_ctype(dtype_sm)\n type_acc = gpuarray.dtype_to_ctype(work_sm)\n params = [\n 'uintp', 'uintp',\n gpuarray.GpuArray, 'uintp', 'intp', 'intp',\n gpuarray.GpuArray, 'uintp', 'intp',\n gpuarray.GpuArray, 'uintp', 'intp', 'intp'\n ]\n kernels = []\n kname = \"kSoftmaxWithBias\"\n k_var = \"kSoftmaxWithBias_\" + nodename\n code = nvcc_kernel(\n kname,\n params=['const ga_size M', 'const ga_size N',\n 'const %s * x' % type_x, 'const ga_size offset_x',\n 'const ga_ssize sx0', 'const ga_ssize sx1',\n 'const %s * b' % type_b, 'const ga_size offset_b',\n 'const ga_ssize sb0',\n '%s * sm' % type_sm, 'const ga_size offset_sm',\n 'const ga_ssize sm_s0', 'const ga_ssize sm_s1'],\n body=[\"extern __shared__ %s buf[]\" % type_acc,\n \"%s * buf2 = buf + N\" % type_acc,\n \"x = (const %s *)(((char *)x)+offset_x)\" % type_x,\n \"b = (const %s *)(((char *)b)+offset_b)\" % type_b,\n \"sm = (%s *)(((char *)sm)+offset_sm)\" % type_sm,\n \"for (int blockIDX = blockIdx.x; blockIDX < M;\"\n \" blockIDX += gridDim.x){\",\n \"for (int tx = threadIdx.x; tx< N; tx += blockDim.x){\",\n \"buf[tx] = %s(x[blockIDX * sx0 + tx * sx1])\" % load_x,\n \"buf[tx] += %s(b[tx * sb0])\" % load_b,\n \"buf2[tx] = buf[tx]\",\n \"}\",\n \"__syncthreads()\",\n inline_softmax('N', 'buf', 'buf2',\n 'threadIdx.x', 'blockDim.x', work_sm),\n \"for (int tx = threadIdx.x; tx< N; tx += blockDim.x){\",\n \"sm[blockIDX * sm_s0 + tx * sm_s1] = %s(buf[tx])\" % write_sm,\n \"}\",\n \"__syncthreads()\",\n \"}\",\n ])\n kernels.append(Kernel(code=code, name=kname, params=params,\n flags=flags, objvar=k_var))\n kname = \"kSoftmaxWithBias_fixed_shared\"\n k_var = \"kSoftmaxWithBias_fixed_shared\" + nodename\n code = nvcc_kernel(\n kname,\n params=['const ga_size M', 'const ga_size N',\n 'const %s * x' % type_x, 'const ga_size offset_x',\n 'const ga_ssize sx0', 'const ga_ssize sx1',\n 'const %s * b' % type_b, 'const ga_size offset_b',\n 'const ga_ssize sb0',\n '%s * sm' % type_sm, 'const ga_size offset_sm',\n 'const ga_ssize sm_s0', 'const ga_ssize sm_s1'],\n body=[\"extern __shared__ %s buf[]\" % type_acc,\n \"x = (const %s *)(((char *)x)+offset_x)\" % type_x,\n \"b = (const %s *)(((char *)b)+offset_b)\" % type_b,\n \"sm = (%s *)(((char *)sm)+offset_sm)\" % type_sm,\n \"for (int blockIDX = blockIdx.x; blockIDX < M;\"\n \" blockIDX += gridDim.x){\",\n \"const %s *x_ptr = &x[blockIDX * sx0]\" % type_x,\n \"%s *sm_ptr = &sm[blockIDX * sm_s0]\" % type_sm,\n inline_softmax_fixed_shared('N', 'buf', 'x_ptr', 'sx1',\n load_x,\n 'sm_ptr', 'sm_s1', write_sm,\n 'threadIdx.x', 'blockDim.x',\n 'b', 'sb0', load_b, work_sm),\n \"__syncthreads()\",\n \"}\",\n ])\n kernels.append(Kernel(code=code, name=kname, params=params,\n flags=flags, objvar=k_var))\n return kernels", "metadata": "root.GpuSoftmaxWithBias.gpu_kernels", "header": "['class', 'GpuSoftmaxWithBias', '(', 'GpuKernelBase', ',', 'Op', ')', ':', '___EOS___']", "index": 892 } ]
[ { "span": "\"for (int blockIDX = blockIdx.x; blockIDX < M;\"\n \" blockIDX += gridDim.x){\",", "start_line": 707, "start_column": 18, "end_line": 708, "end_column": 48 }, { "span": "\"for (int blockIDX = blockIdx.x; blockIDX < M;\"\n \" blockIDX += gridDim.x){\",", "start_line": 737, "start_column": 18, "end_line": 738, "end_column": 48 }, { "span": "\"for (int blockIDX = blockIdx.x; blockIDX < M;\"\n \" blockIDX += gridDim.x){\",", "start_line": 928, "start_column": 18, "end_line": 929, "end_column": 48 }, { "span": "\"for (int blockIDX = blockIdx.x; blockIDX < M;\"\n \" blockIDX += gridDim.x){\",", "start_line": 961, "start_column": 18, "end_line": 962, "end_column": 48 } ]
[]
1
true
[ "[CLS]_", "Implicit", "_", "string_", "concate", "nation_", "in_", "a_", "list_", "[SEP]_", "class_", "Gp", "u", "Softmax", "_", "(_", "Gp", "u", "Kern", "el", "Base_", ",_", "Op_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "gpu", "\\u", "kernels_", "(_", "self_", ",_", "node_", ",_", "nodename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dt", "ype", "\\u", "x_", "=_", "node_", "._", "inputs_", "[_", "0_", "]_", "._", "dtype_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dt", "ype", "\\u", "sm_", "=_", "node_", "._", "outputs_", "[_", "0_", "]_", "._", "dtype_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "load", "\\u", "x_", "=_", "load", "\\u", "w_", "(_", "dt", "ype", "\\u", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "write", "\\u", "sm_", "=_", "write", "\\u", "w_", "(_", "node_", "._", "outputs_", "[_", "0_", "]_", "._", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "work", "\\u", "sm_", "=_", "work", "\\u", "dtype_", "(_", "dt", "ype", "\\u", "sm_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flags_", "=_", "Kernel_", "._", "get", "\\u", "flags_", "(_", "dt", "ype", "\\u", "x_", ",_", "dt", "ype", "\\u", "sm_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "type", "\\u", "x_", "=_", "gpu", "array_", "._", "dt", "ype", "\\u", "to", "\\u", "ctype_", "(_", "dt", "ype", "\\u", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "type", "\\u", "sm_", "=_", "gpu", "array_", "._", "dt", "ype", "\\u", "to", "\\u", "ctype_", "(_", "dt", "ype", "\\u", "sm_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "type", "\\u", "acc_", "=_", "gpu", "array_", "._", "dt", "ype", "\\u", "to", "\\u", "ctype_", "(_", "work", "\\u", "sm_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "uint", "p", "'_", ",_", "'", "uint", "p", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gpu", "array_", "._", "Gp", "u", "Array_", ",_", "'", "uint", "p", "'_", ",_", "'", "intp", "'_", ",_", "'", "intp", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gpu", "array_", "._", "Gp", "u", "Array_", ",_", "'", "uint", "p", "'_", ",_", "'", "intp", "'_", ",_", "'", "intp", "'_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kernels_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kn", "ame_", "=_", "\"", "k", "Softmax", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "k", "\\u", "var_", "=_", "\"", "k", "Softmax", "\\u\"_", "+_", "nodename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", "=_", "nv", "cc", "\\u", "kernel_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "kn", "ame_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "[_", "'", "const", " ", "ga", "\\u", "size", " ", "M", "'_", ",_", "'", "const", " ", "ga", "\\u", "size", " ", "N", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "const", " ", "%", "s", " ", "*", " ", "x", "'_", "%_", "type", "\\u", "x_", ",_", "'", "const", " ", "ga", "\\u", "size", " ", "offset", "\\u", "x", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "const", " ", "ga", "\\u", "ssi", "ze", " ", "sx", "0", "'_", ",_", "'", "const", " ", "ga", "\\u", "ssi", "ze", " ", "sx", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "s", " ", "*", " ", "sm", "'_", "%_", "type", "\\u", "sm_", ",_", "'", "const", " ", "ga", "\\u", "size", " ", "offset", "\\u", "sm", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "const", " ", "ga", "\\u", "ssi", "ze", " ", "sm", "\\u", "s0", "'_", ",_", "'", "const", " ", "ga", "\\u", "ssi", "ze", " ", "sm", "\\u", "s1", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "body_", "=_", "[_", "\"", "extern", " ", "\\u\\u", "shared", "\\u\\u", " ", "%", "s", " ", "buf", "[]\"_", "%_", "type", "\\u", "acc_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"%", "s", " ", "*", " ", "buf", "2", " ", "=", " ", "buf", " ", "+", " ", "N", "\"_", "%_", "type", "\\u", "acc_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "x", " ", "=", " ", "(", "const", " ", "%", "s", " ", "*)(", "((", "char", " ", "*)", "x", ")+", "offset", "\\u", "x", ")\"_", "%_", "type", "\\u", "x_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sm", " ", "=", " ", "(%", "s", " ", "*)(", "((", "char", " ", "*)", "sm", ")+", "offset", "\\u", "sm", ")\"_", "%_", "type", "\\u", "sm_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "for", " ", "(", "int", " ", "block", "IDX", " ", "=", " ", "block", "Id", "x", ".", "x", ";", " ", "block", "IDX", " ", "<", " ", "M", ";\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "block", "IDX", " ", "+=", " ", "grid", "Dim", ".", "x", "){", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "for", " ", "(", "int", " ", "tx", " ", "=", " ", "thread", "Id", "x", ".", "x", ";", " ", "tx", "<", " ", "N", ";", " ", "tx", " ", "+=", " ", "block", "Dim", ".", "x", "){", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "buf", "[", "tx", "]", " ", "=", " ", "%", "s", "(", "x", "[", "block", "IDX", " ", "*", " ", "sx", "0", " ", "+", " ", "tx", " ", "*", " ", "sx", "1", "])\"_", "%_", "load", "\\u", "x_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "buf", "2", "[", "tx", "]", " ", "=", " ", "buf", "[", "tx", "]\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"}\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"\\u\\u", "sync", "thread", "s", "()\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "inline", "\\u", "softmax_", "(_", "'", "N", "'_", ",_", "'", "buf", "'_", ",_", "'", "buf", "2", "'_", ",_", "'", "thread", "Id", "x", ".", "x", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "block", "Dim", ".", "x", "'_", ",_", "dtype_", "=_", "work", "\\u", "sm_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "for", " ", "(", "int", " ", "tx", " ", "=", " ", "thread", "Id", "x", ".", "x", ";", " ", "tx", "<", " ", "N", ";", " ", "tx", " ", "+=", " ", "block", "Dim", ".", "x", "){", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "set", " ", "all", " ", "value", " ", "correct", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sm", "[", "block", "IDX", " ", "*", " ", "sm", "\\u", "s0", " ", "+", " ", "tx", " ", "*", " ", "sm", "\\u", "s1", "]", " ", "=", " ", "%", "s", "(", "buf", "[", "tx", "])\"_", "%_", "write", "\\u", "sm_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"}\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"\\u\\u", "sync", "thread", "s", "()\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"}\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kernels_", "._", "append_", "(_", "Kernel_", "(_", "code_", "=_", "code_", ",_", "name_", "=_", "kn", "ame_", ",_", "params_", "=_", "params_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "flags_", "=_", "flags_", ",_", "obj", "var_", "=_", "k", "\\u", "var_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kn", "ame_", "=_", "\"", "k", "Softmax", "\\u", "fixed", "\\u", "shared", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "k", "\\u", "var_", "=_", "\"", "k", "Softmax", "\\u", "fixed", "\\u", "shared", "\"_", "+_", "nodename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", "=_", "nv", "cc", "\\u", "kernel_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "kn", "ame_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "[_", "'", "const", " ", "ga", "\\u", "size", " ", "M", "'_", ",_", "'", "const", " ", "ga", "\\u", "size", " ", "N", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "const", " ", "%", "s", " ", "*", " ", "x", "'_", "%_", "type", "\\u", "x_", ",_", "'", "const", " ", "ga", "\\u", "size", " ", "offset", "\\u", "x", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "const", " ", "ga", "\\u", "ssi", "ze", " ", "sx", "0", "'_", ",_", "'", "const", " ", "ga", "\\u", "ssi", "ze", " ", "sx", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "s", " ", "*", " ", "sm", "'_", "%_", "type", "\\u", "sm_", ",_", "'", "const", " ", "ga", "\\u", "size", " ", "offset", "\\u", "sm", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "const", " ", "ga", "\\u", "ssi", "ze", " ", "sm", "\\u", "s0", "'_", ",_", "'", "const", " ", "ga", "\\u", "ssi", "ze", " ", "sm", "\\u", "s1", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "body_", "=_", "[_", "\"", "extern", " ", "\\u\\u", "shared", "\\u\\u", " ", "%", "s", " ", "buf", "[]\"_", "%_", "type", "\\u", "acc_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "x", " ", "=", " ", "(", "const", " ", "%", "s", " ", "*)(", "((", "char", " ", "*)", "x", ")+", "offset", "\\u", "x", ")\"_", "%_", "type", "\\u", "x_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sm", " ", "=", " ", "(%", "s", " ", "*)(", "((", "char", " ", "*)", "sm", ")+", "offset", "\\u", "sm", ")\"_", "%_", "type", "\\u", "sm_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "for", " ", "(", "int", " ", "block", "IDX", " ", "=", " ", "block", "Id", "x", ".", "x", ";", " ", "block", "IDX", " ", "<", " ", "M", ";\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "block", "IDX", " ", "+=", " ", "grid", "Dim", ".", "x", "){", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "const", " ", "%", "s", " ", "*", "x", "\\u", "ptr", " ", "=", " ", "&", "x", "[", "block", "IDX", " ", "*", " ", "sx", "0", "]\"_", "%_", "type", "\\u", "x_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"%", "s", " ", "*", "sm", "\\u", "ptr", " ", "=", " ", "&", "sm", "[", "block", "IDX", " ", "*", " ", "sm", "\\u", "s0", "]\"_", "%_", "type", "\\u", "sm_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "inline", "\\u", "soft", "max", "\\u", "fixed", "\\u", "shared_", "(_", "'", "N", "'_", ",_", "'", "buf", "'_", ",_", "'", "x", "\\u", "ptr", "'_", ",_", "'", "sx", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "load", "\\u", "x_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sm", "\\u", "ptr", "'_", ",_", "'", "sm", "\\u", "s1", "'_", ",_", "write", "\\u", "sm_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "thread", "Id", "x", ".", "x", "'_", ",_", "'", "block", "Dim", ".", "x", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dtype_", "=_", "work", "\\u", "sm_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"\\u\\u", "sync", "thread", "s", "()\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"}\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kernels_", "._", "append_", "(_", "Kernel_", "(_", "code_", "=_", "code_", ",_", "name_", "=_", "kn", "ame_", ",_", "params_", "=_", "params_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "flags_", "=_", "flags_", ",_", "obj", "var_", "=_", "k", "\\u", "var_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "kernels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gp", "u", "Softmax", "With", "Bia", "s_", "(_", "Gp", "u", "Kern", "el", "Base_", ",_", "Op_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "gpu", "\\u", "kernels_", "(_", "self_", ",_", "node_", ",_", "nodename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dt", "ype", "\\u", "x_", "=_", "node_", "._", "inputs_", "[_", "0_", "]_", "._", "dtype_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dt", "ype", "\\u", "b_", "=_", "node_", "._", "inputs_", "[_", "1_", "]_", "._", "dtype_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dt", "ype", "\\u", "sm_", "=_", "node_", "._", "outputs_", "[_", "0_", "]_", "._", "dtype_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "load", "\\u", "x_", "=_", "load", "\\u", "w_", "(_", "node_", "._", "inputs_", "[_", "0_", "]_", "._", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "load", "\\u", "b_", "=_", "load", "\\u", "w_", "(_", "node_", "._", "inputs_", "[_", "1_", "]_", "._", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "write", "\\u", "sm_", "=_", "write", "\\u", "w_", "(_", "node_", "._", "outputs_", "[_", "0_", "]_", "._", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "work", "\\u", "sm_", "=_", "work", "\\u", "dtype_", "(_", "node_", "._", "outputs_", "[_", "0_", "]_", "._", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flags_", "=_", "Kernel_", "._", "get", "\\u", "flags_", "(_", "dt", "ype", "\\u", "x_", ",_", "dt", "ype", "\\u", "b_", ",_", "dt", "ype", "\\u", "sm_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "type", "\\u", "x_", "=_", "gpu", "array_", "._", "dt", "ype", "\\u", "to", "\\u", "ctype_", "(_", "dt", "ype", "\\u", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "type", "\\u", "b_", "=_", "gpu", "array_", "._", "dt", "ype", "\\u", "to", "\\u", "ctype_", "(_", "dt", "ype", "\\u", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "type", "\\u", "sm_", "=_", "gpu", "array_", "._", "dt", "ype", "\\u", "to", "\\u", "ctype_", "(_", "dt", "ype", "\\u", "sm_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "type", "\\u", "acc_", "=_", "gpu", "array_", "._", "dt", "ype", "\\u", "to", "\\u", "ctype_", "(_", "work", "\\u", "sm_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "uint", "p", "'_", ",_", "'", "uint", "p", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gpu", "array_", "._", "Gp", "u", "Array_", ",_", "'", "uint", "p", "'_", ",_", "'", "intp", "'_", ",_", "'", "intp", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gpu", "array_", "._", "Gp", "u", "Array_", ",_", "'", "uint", "p", "'_", ",_", "'", "intp", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gpu", "array_", "._", "Gp", "u", "Array_", ",_", "'", "uint", "p", "'_", ",_", "'", "intp", "'_", ",_", "'", "intp", "'_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kernels_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kn", "ame_", "=_", "\"", "k", "Softmax", "With", "Bia", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "k", "\\u", "var_", "=_", "\"", "k", "Softmax", "With", "Bia", "s", "\\u\"_", "+_", "nodename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", "=_", "nv", "cc", "\\u", "kernel_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "kn", "ame_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "[_", "'", "const", " ", "ga", "\\u", "size", " ", "M", "'_", ",_", "'", "const", " ", "ga", "\\u", "size", " ", "N", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "const", " ", "%", "s", " ", "*", " ", "x", "'_", "%_", "type", "\\u", "x_", ",_", "'", "const", " ", "ga", "\\u", "size", " ", "offset", "\\u", "x", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "const", " ", "ga", "\\u", "ssi", "ze", " ", "sx", "0", "'_", ",_", "'", "const", " ", "ga", "\\u", "ssi", "ze", " ", "sx", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "const", " ", "%", "s", " ", "*", " ", "b", "'_", "%_", "type", "\\u", "b_", ",_", "'", "const", " ", "ga", "\\u", "size", " ", "offset", "\\u", "b", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "const", " ", "ga", "\\u", "ssi", "ze", " ", "sb", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "s", " ", "*", " ", "sm", "'_", "%_", "type", "\\u", "sm_", ",_", "'", "const", " ", "ga", "\\u", "size", " ", "offset", "\\u", "sm", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "const", " ", "ga", "\\u", "ssi", "ze", " ", "sm", "\\u", "s0", "'_", ",_", "'", "const", " ", "ga", "\\u", "ssi", "ze", " ", "sm", "\\u", "s1", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "body_", "=_", "[_", "\"", "extern", " ", "\\u\\u", "shared", "\\u\\u", " ", "%", "s", " ", "buf", "[]\"_", "%_", "type", "\\u", "acc_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"%", "s", " ", "*", " ", "buf", "2", " ", "=", " ", "buf", " ", "+", " ", "N", "\"_", "%_", "type", "\\u", "acc_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "x", " ", "=", " ", "(", "const", " ", "%", "s", " ", "*)(", "((", "char", " ", "*)", "x", ")+", "offset", "\\u", "x", ")\"_", "%_", "type", "\\u", "x_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "b", " ", "=", " ", "(", "const", " ", "%", "s", " ", "*)(", "((", "char", " ", "*)", "b", ")+", "offset", "\\u", "b", ")\"_", "%_", "type", "\\u", "b_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sm", " ", "=", " ", "(%", "s", " ", "*)(", "((", "char", " ", "*)", "sm", ")+", "offset", "\\u", "sm", ")\"_", "%_", "type", "\\u", "sm_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "for", " ", "(", "int", " ", "block", "IDX", " ", "=", " ", "block", "Id", "x", ".", "x", ";", " ", "block", "IDX", " ", "<", " ", "M", ";\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "block", "IDX", " ", "+=", " ", "grid", "Dim", ".", "x", "){", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "for", " ", "(", "int", " ", "tx", " ", "=", " ", "thread", "Id", "x", ".", "x", ";", " ", "tx", "<", " ", "N", ";", " ", "tx", " ", "+=", " ", "block", "Dim", ".", "x", "){", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "buf", "[", "tx", "]", " ", "=", " ", "%", "s", "(", "x", "[", "block", "IDX", " ", "*", " ", "sx", "0", " ", "+", " ", "tx", " ", "*", " ", "sx", "1", "])\"_", "%_", "load", "\\u", "x_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "buf", "[", "tx", "]", " ", "+=", " ", "%", "s", "(", "b", "[", "tx", " ", "*", " ", "sb", "0", "])\"_", "%_", "load", "\\u", "b_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "buf", "2", "[", "tx", "]", " ", "=", " ", "buf", "[", "tx", "]\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"}\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"\\u\\u", "sync", "thread", "s", "()\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "inline", "\\u", "softmax_", "(_", "'", "N", "'_", ",_", "'", "buf", "'_", ",_", "'", "buf", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "thread", "Id", "x", ".", "x", "'_", ",_", "'", "block", "Dim", ".", "x", "'_", ",_", "work", "\\u", "sm_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "for", " ", "(", "int", " ", "tx", " ", "=", " ", "thread", "Id", "x", ".", "x", ";", " ", "tx", "<", " ", "N", ";", " ", "tx", " ", "+=", " ", "block", "Dim", ".", "x", "){", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sm", "[", "block", "IDX", " ", "*", " ", "sm", "\\u", "s0", " ", "+", " ", "tx", " ", "*", " ", "sm", "\\u", "s1", "]", " ", "=", " ", "%", "s", "(", "buf", "[", "tx", "])\"_", "%_", "write", "\\u", "sm_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"}\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"\\u\\u", "sync", "thread", "s", "()\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"}\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kernels_", "._", "append_", "(_", "Kernel_", "(_", "code_", "=_", "code_", ",_", "name_", "=_", "kn", "ame_", ",_", "params_", "=_", "params_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "flags_", "=_", "flags_", ",_", "obj", "var_", "=_", "k", "\\u", "var_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kn", "ame_", "=_", "\"", "k", "Softmax", "With", "Bia", "s", "\\u", "fixed", "\\u", "shared", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "k", "\\u", "var_", "=_", "\"", "k", "Softmax", "With", "Bia", "s", "\\u", "fixed", "\\u", "shared", "\"_", "+_", "nodename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", "=_", "nv", "cc", "\\u", "kernel_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "kn", "ame_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "[_", "'", "const", " ", "ga", "\\u", "size", " ", "M", "'_", ",_", "'", "const", " ", "ga", "\\u", "size", " ", "N", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "const", " ", "%", "s", " ", "*", " ", "x", "'_", "%_", "type", "\\u", "x_", ",_", "'", "const", " ", "ga", "\\u", "size", " ", "offset", "\\u", "x", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "const", " ", "ga", "\\u", "ssi", "ze", " ", "sx", "0", "'_", ",_", "'", "const", " ", "ga", "\\u", "ssi", "ze", " ", "sx", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "const", " ", "%", "s", " ", "*", " ", "b", "'_", "%_", "type", "\\u", "b_", ",_", "'", "const", " ", "ga", "\\u", "size", " ", "offset", "\\u", "b", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "const", " ", "ga", "\\u", "ssi", "ze", " ", "sb", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "s", " ", "*", " ", "sm", "'_", "%_", "type", "\\u", "sm_", ",_", "'", "const", " ", "ga", "\\u", "size", " ", "offset", "\\u", "sm", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "const", " ", "ga", "\\u", "ssi", "ze", " ", "sm", "\\u", "s0", "'_", ",_", "'", "const", " ", "ga", "\\u", "ssi", "ze", " ", "sm", "\\u", "s1", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "body_", "=_", "[_", "\"", "extern", " ", "\\u\\u", "shared", "\\u\\u", " ", "%", "s", " ", "buf", "[]\"_", "%_", "type", "\\u", "acc_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "x", " ", "=", " ", "(", "const", " ", "%", "s", " ", "*)(", "((", "char", " ", "*)", "x", ")+", "offset", "\\u", "x", ")\"_", "%_", "type", "\\u", "x_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "b", " ", "=", " ", "(", "const", " ", "%", "s", " ", "*)(", "((", "char", " ", "*)", "b", ")+", "offset", "\\u", "b", ")\"_", "%_", "type", "\\u", "b_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sm", " ", "=", " ", "(%", "s", " ", "*)(", "((", "char", " ", "*)", "sm", ")+", "offset", "\\u", "sm", ")\"_", "%_", "type", "\\u", "sm_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "for", " ", "(", "int", " ", "block", "IDX", " ", "=", " ", "block", "Id", "x", ".", "x", ";", " ", "block", "IDX", " ", "<", " ", "M", ";\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "block", "IDX", " ", "+=", " ", "grid", "Dim", ".", "x", "){", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "const", " ", "%", "s", " ", "*", "x", "\\u", "ptr", " ", "=", " ", "&", "x", "[", "block", "IDX", " ", "*", " ", "sx", "0", "]\"_", "%_", "type", "\\u", "x_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"%", "s", " ", "*", "sm", "\\u", "ptr", " ", "=", " ", "&", "sm", "[", "block", "IDX", " ", "*", " ", "sm", "\\u", "s0", "]\"_", "%_", "type", "\\u", "sm_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "inline", "\\u", "soft", "max", "\\u", "fixed", "\\u", "shared_", "(_", "'", "N", "'_", ",_", "'", "buf", "'_", ",_", "'", "x", "\\u", "ptr", "'_", ",_", "'", "sx", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "load", "\\u", "x_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sm", "\\u", "ptr", "'_", ",_", "'", "sm", "\\u", "s1", "'_", ",_", "write", "\\u", "sm_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "thread", "Id", "x", ".", "x", "'_", ",_", "'", "block", "Dim", ".", "x", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "b", "'_", ",_", "'", "sb", "0", "'_", ",_", "load", "\\u", "b_", ",_", "work", "\\u", "sm_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"\\u\\u", "sync", "thread", "s", "()\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"}\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kernels_", "._", "append_", "(_", "Kernel_", "(_", "code_", "=_", "code_", ",_", "name_", "=_", "kn", "ame_", ",_", "params_", "=_", "params_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "flags_", "=_", "flags_", ",_", "obj", "var_", "=_", "k", "\\u", "var_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "kernels_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
splunk/splunk-webframework/server/splunkdj/middlewares.py
[ { "content": "\nfrom django.middleware.csrf import get_token\nfrom django.conf import settings\nfrom django.middleware.locale import LocaleMiddleware\nfrom django.core.urlresolvers import is_valid_path, resolve, reverse\nfrom django.http import HttpResponseRedirect\nfrom django.utils.cache import patch_vary_headers\nfrom django.utils import translation\nfrom django.http import Http404\n\nfrom splunkdj.auth.backends import get_user\nfrom splunkdj.utility import format_local_tzoffset, create_derived_service\n\nimport datetime\nimport time\nimport logging, logging.handlers\nimport rfc822\nimport sys\nimport os\n\nlogger = logging.getLogger('spl.django.service')\n \n \n \n \n \n\n# This Django request logger is an implementation of Splunkweb's logging \n# handler. Django's objects are different, but the resulting logs are meant\n# to be the same as Splunkweb\n\n \n\n \n ", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class SplunkCsrfMiddleware(object):", "metadata": "root.SplunkCsrfMiddleware", "header": "['module', '___EOS___']", "index": 22 }, { "content": " def process_view(self, request, *args, **kwargs):\n get_token(request)\n return None", "metadata": "root.SplunkCsrfMiddleware.process_view", "header": "['class', 'SplunkCsrfMiddleware', '(', 'object', ')', ':', '___EOS___']", "index": 23 }, { "content": "class SplunkResolvedUrlMiddleware(object):", "metadata": "root.SplunkResolvedUrlMiddleware", "header": "['module', '___EOS___']", "index": 27 }, { "content": " def process_request(self, request):\n # Set a default so we don't have to ensure it has the attribute\n request.app_name = None\n request.url_name = None\n \n resolved = None\n try:\n resolved = resolve(request.path_info)\n except:\n # If we had an error in resolution, then we can continue, we don't\n # need to do anything\n pass\n \n # If we don't have a resolved match, there is nothing for us to do. \n # We can just go ahead and return.\n if resolved:\n request.app_name = resolved.app_name\n request.url_name = resolved.url_name\n \n return", "metadata": "root.SplunkResolvedUrlMiddleware.process_request", "header": "['class', 'SplunkResolvedUrlMiddleware', '(', 'object', ')', ':', '___EOS___']", "index": 28 }, { "content": "class SplunkAppEnabledMiddleware(object):\n \"\"\"\n Ensure that when a URL pattern is accessed in a particular app-scope,\n that the app in question is enabled.\n \"\"\"\n \n ", "metadata": "root.SplunkAppEnabledMiddleware", "header": "['module', '___EOS___']", "index": 49 }, { "content": " def _verify_app_is_enabled(self, service, app_name):\n if app_name and app_name == 'homefx':\n return\n \n # We need to use the most general service as the app may be disabled.\n service = create_derived_service(service, app=None, owner=None)\n try:\n app = service.apps[app_name]\n if app['disabled'] == '1' or app['visible'] == '0':\n raise Http404(\"Application '%s' is disabled.\" % app_name)\n except:\n raise Http404(\"Application '%s' is disabled.\" % app_name)", "metadata": "root.SplunkAppEnabledMiddleware._verify_app_is_enabled", "header": "['class', 'SplunkAppEnabledMiddleware', '(', 'object', ')', ':', '___EOS___']", "index": 55 }, { "content": " def process_request(self, request):\n if request.app_name and request.user.is_authenticated():\n # Now that we have a name for the app, we can go ahead and\n # try and see if that app is enabled.\n return self._verify_app_is_enabled(request.service, request.app_name)\n \n return", "metadata": "root.SplunkAppEnabledMiddleware.process_request", "header": "['class', 'SplunkAppEnabledMiddleware', '(', 'object', ')', ':', '___EOS___']", "index": 68 }, { "content": "class SplunkLocaleMiddleware(LocaleMiddleware):\n # The base LocaleMiddleware class in Django core does not seem to properly\n # handle redirects when Django is not mounted on the root. This simply\n # reimplements the logic for handling the response, most of this code is\n # taken verbatim, and we only changed the path that we redirect to.", "metadata": "root.SplunkLocaleMiddleware", "header": "['module', '___EOS___']", "index": 76 }, { "content": " def process_response(self, request, response):\n language = translation.get_language()\n if (response.status_code == 404 and\n not translation.get_language_from_path(request.path_info)\n and self.is_language_prefix_patterns_used()):\n urlconf = getattr(request, 'urlconf', None)\n language_path = '/%s%s' % (language, request.path_info)\n path_valid = is_valid_path(language_path, urlconf)\n if (not path_valid and settings.APPEND_SLASH\n and not language_path.endswith('/')):\n path_valid = is_valid_path(\"%s/\" % language_path, urlconf)\n\n if path_valid:\n path = request.get_full_path()\n script_mount = request.META.get(\"SCRIPT_NAME\", \"\")\n \n if path.startswith(script_mount):\n path = path.replace(script_mount, (\"%s/%s\" % (script_mount, language)), 1)\n \n language_url = \"%s://%s%s\" % (\n request.is_secure() and 'https' or 'http',\n request.get_host(), path)\n return HttpResponseRedirect(language_url)\n translation.deactivate()\n\n patch_vary_headers(response, ('Accept-Language',))\n if 'Content-Language' not in response:\n response['Content-Language'] = language\n return response", "metadata": "root.SplunkLocaleMiddleware.process_response", "header": "['class', 'SplunkLocaleMiddleware', '(', 'LocaleMiddleware', ')', ':', '___NEWLINE___', '# The base LocaleMiddleware class in Django core does not seem to properly', '___NL___', '# handle redirects when Django is not mounted on the root. This simply', '___NL___', '# reimplements the logic for handling the response, most of this code is', '___NL___', '# taken verbatim, and we only changed the path that we redirect to.', '___NL___', '___EOS___']", "index": 81 }, { "content": "class SplunkWebSessionMiddleware(object):\n \n ", "metadata": "root.SplunkWebSessionMiddleware", "header": "['module', '___EOS___']", "index": 111 }, { "content": " def __init__(self, port=8000, **kwargs):\n \n self._initialized = False\n self._storage_path = None\n \n if not settings.SPLUNK_WEB_INTEGRATED:\n return\n \n try:\n from lib.util import splunk_to_cherry_cfg, make_absolute\n \n cherrypy_cfg = splunk_to_cherry_cfg('web', 'settings')\n \n storage_type = cherrypy_cfg.get('tools.sessions.storage_type')\n storage_path = None\n \n if storage_type == 'file':\n storage_path = make_absolute(cherrypy_cfg['tools.sessions.storage_path'])\n else:\n return\n \n self._storage_path = storage_path\n self._initialized = True\n except Exception, e:\n self._initialized = False\n pass", "metadata": "root.SplunkWebSessionMiddleware.__init__", "header": "['class', 'SplunkWebSessionMiddleware', '(', 'object', ')', ':', '___EOS___']", "index": 112 }, { "content": " def process_request(self, request):\n if not self._initialized or not self._storage_path:\n return\n \n user = None\n session = None\n \n try:\n from lib.sessions import FileSession\n \n cookie_name = 'session_id_%s' % settings.SPLUNK_WEB_PORT\n if cookie_name not in request.COOKIES:\n return\n \n splunkweb_cookie = request.COOKIES[cookie_name]\n \n session = FileSession(\n splunkweb_cookie,\n storage_path=self._storage_path,\n timeout=60,\n clean_freq=5\n )\n \n # Acquire the lock. If this fails, we assume that the lock is no\n # longer acquired, and thus does not need to be released. Any \n # future use is protected by the try/finally which will release\n # the lock when it is complete.\n session.acquire_lock(read_lock=True)\n \n # DO NOT PUT ANYTHING HERE. ALL CODE SHOULD BE INSIDE THE TRY/FINALLY,\n # SO THAT WE CAN ENSURE THE SESSION LOCK GETS RELEASED.\n \n try:\n if 'sessionKey' in session:\n session_key = \"Splunk %s\" % session['sessionKey']\n username = None\n \n if 'user' in session and 'name' in session['user']:\n username = session['user']['name']\n \n user = get_user(username, session_key)\n if user:\n request._cached_user = user\n finally:\n # If we failed to create a user, and we have a session,\n # then we need to delete the session.\n # The main reason is that if we don't have a user, it means\n # we are not authenticated. If we aren't authenticated, we'll\n # get redirected to Splunkweb's login page, which will just \n # redirect us back if a sessionKey value exists (whether it\n # is valid or not). We then get into an infinite redirect loop,\n # as we'll just come back here.\n if not user:\n session.delete()\n \n # Release the lock\n session.release_lock()\n \n except Exception, e:\n logger.exception(e)\n pass", "metadata": "root.SplunkWebSessionMiddleware.process_request", "header": "['class', 'SplunkWebSessionMiddleware', '(', 'object', ')', ':', '___EOS___']", "index": 140 }, { "content": "class SplunkDjangoRequestLoggingMiddleware(object):\n error_logger = None\n access_logger = None\n\n access_log_format = '%(h)s %(l)s %(u)s %(t)s \"%(r)s\" %(s)s %(b)s \"%(f)s\" \"%(a)s\"' \n\n\n", "metadata": "root.SplunkDjangoRequestLoggingMiddleware", "header": "['module', '___EOS___']", "index": 206 }, { "content": " def __init__(self):\n self.access_logger = logging.getLogger('spl.django.access')\n self.error_logger = logging.getLogger('spl.django.error')", "metadata": "root.SplunkDjangoRequestLoggingMiddleware.__init__", "header": "['class', 'SplunkDjangoRequestLoggingMiddleware', '(', 'object', ')', ':', '___EOS___']", "index": 212 }, { "content": " def process_response(self, request, response):\n\n \"\"\"\n Write to the access log (in Apache/NCSA Combined Log format).\n\n This is a port of the Splunk web_access logging code. It is a rough\n mapping of request objects in the splunk web cherrypy server to equivalent\n objects in the django environment \n \"\"\"\n atoms = {'h': request.META.get('REMOTE_ADDR', ''),# or REMOTE_HOST\n 'l': '-',\n 'u': getattr(request, 'user', '-'),\n 't': self.access_time(time.time()), #TODO: splunkweb uses cherrypy.serving.response.time\n 'r': \"%s %s %s\" % (request.method, \n request.get_full_path(), \n request.META.get('SERVER_PROTOCOL', '')), #or ACTUAL_SERVER_PROTOCOL\n 's': response.status_code,\n 'b': len(response.content) or '-',\n 'f': request.META.get('HTTP_REFERER', ''),\n 'a': request.META.get('HTTP_USER_AGENT', ''),\n }\n\n for k, v in atoms.items():\n if isinstance(v, unicode):\n v = v.encode('utf8')\n elif not isinstance(v, str):\n v = str(v)\n # Fortunately, repr(str) escapes unprintable chars, \\n, \\t, etc\n # and backslash for us. All we have to do is strip the quotes.\n v = repr(v)[1:-1]\n # Escape double-quote.\n atoms[k] = v.replace('\"', '\\\\\"')\n\n try:\n #TODO: add a response id and time here?\n self.access_logger.info(self.access_log_format % atoms)\n except:\n error_logger.log(\"Error writing access log\")\n self(traceback=true)\n\n return response", "metadata": "root.SplunkDjangoRequestLoggingMiddleware.process_response", "header": "['class', 'SplunkDjangoRequestLoggingMiddleware', '(', 'object', ')', ':', '___EOS___']", "index": 216 }, { "content": " def access_time(self, req_time):\n now = datetime.datetime.fromtimestamp(req_time)\n month = rfc822._monthnames[now.month - 1].capitalize()\n return ('[%02d/%s/%04d:%02d:%02d:%02d.%03d %s]' %\n (now.day, month, now.year, now.hour, now.minute, now.second, \n now.microsecond/1000, format_local_tzoffset(req_time)))", "metadata": "root.SplunkDjangoRequestLoggingMiddleware.access_time", "header": "['class', 'SplunkDjangoRequestLoggingMiddleware', '(', 'object', ')', ':', '___EOS___']", "index": 258 } ]
[ { "span": "from django.core.urlresolvers import is_valid_path, resolve, reverse", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 68 }, { "span": "import sys", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 10 }, { "span": "import os", "start_line": 18, "start_column": 0, "end_line": 18, "end_column": 9 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "middleware_", "._", "csrf_", "import_", "get", "\\u", "token_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "middleware_", "._", "locale_", "import_", "Local", "e", "Middleware_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "urlresolvers_", "import_", "is", "\\u", "valid", "\\u", "path_", ",_", "resolve_", ",_", "reverse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "http_", "import_", "Http", "Respons", "e", "Redirect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "cache_", "import_", "patch", "\\u", "vary", "\\u", "headers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "import_", "translation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "http_", "import_", "Http404_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "splu", "nk", "dj", "_", "._", "auth_", "._", "backends_", "import_", "get", "\\u", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "splu", "nk", "dj", "_", "._", "utility_", "import_", "format\\u", "local", "\\u", "tz", "offset_", ",_", "create", "\\u", "derive", "d\\u", "service_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", ",_", "logging_", "._", "handlers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "rfc", "822", "_", "\\u\\u\\uNEWLINE\\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_", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "'", "spl", ".", "django", ".", "service", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "Dj", "ang", "o", " ", "request", " ", "logg", "er", " ", "is", " ", "an", " ", "implementation", " ", "of", " ", "Spl", "unk", "web", "'", "s", " ", "logg", "ing", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "handler", ".", " ", "Dj", "ang", "o", "'", "s", " ", "object", "s", " ", "are", " ", "different", ",", " ", "but", " ", "the", " ", "result", "ing", " ", "logs", " ", "are", " ", "mean", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "be", " ", "the", " ", "same", " ", "as", " ", "Spl", "unk", "web_", "\\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_", "Spl", "unk", "Cs", "rf", "Middleware_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spl", "unk", "Cs", "rf", "Middleware_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "process", "\\u", "view_", "(_", "self_", ",_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "get", "\\u", "token_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Spl", "unk", "Resolved", "Ur", "l", "Middleware_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spl", "unk", "Resolved", "Ur", "l", "Middleware_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "process", "\\u", "request_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Set", " ", "a", " ", "default", " ", "so", " ", "we", " ", "don", "'", "t", " ", "have", " ", "to", " ", "ensure", " ", "it", " ", "has", " ", "the", " ", "attribute_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "._", "app", "\\u", "name_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "url", "\\u", "name_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resolved_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resolved_", "=_", "resolve_", "(_", "request_", "._", "path", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "we", " ", "had", " ", "an", " ", "error", " ", "in", " ", "resolu", "tion", ",", " ", "then", " ", "we", " ", "can", " ", "continue", ",", " ", "we", " ", "don", "'", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "need", " ", "to", " ", "do", " ", "anyt", "hing_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "we", " ", "don", "'", "t", " ", "have", " ", "a", " ", "resolve", "d", " ", "match", ",", " ", "there", " ", "is", " ", "not", "hing", " ", "for", " ", "us", " ", "to", " ", "do", ".", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "can", " ", "just", " ", "go", " ", "ahe", "ad", " ", "and", " ", "return", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "resolved_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "._", "app", "\\u", "name_", "=_", "resolved_", "._", "app", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "url", "\\u", "name_", "=_", "resolved_", "._", "url", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Spl", "unk", "App", "Enable", "d", "Middleware_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ensur", "e", " ", "tha", "t", " ", "whe", "n", " ", "a", " ", "URL", " ", "pattern", " ", "is", " ", "accesse", "d", " ", "in", " ", "a", " ", "partic", "ular", " ", "app", "-", "scope", ",", "\\", "10", ";", " ", " ", " ", " ", "tha", "t", " ", "the", " ", "app", " ", "in", " ", "question", " ", "is", " ", "enable", "d", ".", "\\", "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_", "Spl", "unk", "App", "Enable", "d", "Middleware_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "verify", "\\u", "app", "\\u", "is", "\\u", "enabled_", "(_", "self_", ",_", "service_", ",_", "app", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "app", "\\u", "name_", "and_", "app", "\\u", "name_", "==_", "'", "home", "fx", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "need", " ", "to", " ", "use", " ", "the", " ", "most", " ", "genera", "l", " ", "service", " ", "as", " ", "the", " ", "app", " ", "may", " ", "be", " ", "disable", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "service_", "=_", "create", "\\u", "derive", "d\\u", "service_", "(_", "service_", ",_", "app_", "=_", "None_", ",_", "owner_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "=_", "service_", "._", "apps_", "[_", "app", "\\u", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "app_", "[_", "'", "disable", "d", "'_", "]_", "==_", "'", "1", "'_", "or_", "app_", "[_", "'", "visi", "ble", "'_", "]_", "==_", "'", "0", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Http404_", "(_", "\"", "Applica", "tion", " ", "'%", "s", "'", " ", "is", " ", "disable", "d", ".\"_", "%_", "app", "\\u", "name_", ")_", "\\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_", "Http404_", "(_", "\"", "Applica", "tion", " ", "'%", "s", "'", " ", "is", " ", "disable", "d", ".\"_", "%_", "app", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spl", "unk", "App", "Enable", "d", "Middleware_", "(_", "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_", "process", "\\u", "request_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "app", "\\u", "name_", "and_", "request_", "._", "user_", "._", "is", "\\u", "authenticated_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", "w", " ", "tha", "t", " ", "we", " ", "have", " ", "a", " ", "name", " ", "for", " ", "the", " ", "app", ",", " ", "we", " ", "can", " ", "go", " ", "ahe", "ad", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "try", " ", "and", " ", "see", " ", "if", " ", "tha", "t", " ", "app", " ", "is", " ", "enable", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "verify", "\\u", "app", "\\u", "is", "\\u", "enabled_", "(_", "request_", "._", "service_", ",_", "request_", "._", "app", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Spl", "unk", "Local", "e", "Middleware_", "(_", "Local", "e", "Middleware_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "base", " ", "Local", "e", "Mid", "dle", "ware", " ", "class", " ", "in", " ", "Dj", "ang", "o", " ", "core", " ", "doe", "s", " ", "not", " ", "see", "m", " ", "to", " ", "proper", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "handle", " ", "redirec", "ts", " ", "whe", "n", " ", "Dj", "ang", "o", " ", "is", " ", "not", " ", "mounte", "d", " ", "on", " ", "the", " ", "root", ".", " ", "Thi", "s", " ", "simp", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "rei", "mple", "ment", "s", " ", "the", " ", "logic", " ", "for", " ", "handling", " ", "the", " ", "response", ",", " ", "most", " ", "of", " ", "this", " ", "code", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "take", "n", " ", "verba", "tim", ",", " ", "and", " ", "we", " ", "only", " ", "change", "d", " ", "the", " ", "path", " ", "tha", "t", " ", "we", " ", "redirec", "t", " ", "to", "._", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Spl", "unk", "Local", "e", "Middleware_", "(_", "Local", "e", "Middleware_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "base", " ", "Local", "e", "Mid", "dle", "ware", " ", "class", " ", "in", " ", "Dj", "ang", "o", " ", "core", " ", "doe", "s", " ", "not", " ", "see", "m", " ", "to", " ", "proper", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "handle", " ", "redirec", "ts", " ", "whe", "n", " ", "Dj", "ang", "o", " ", "is", " ", "not", " ", "mounte", "d", " ", "on", " ", "the", " ", "root", ".", " ", "Thi", "s", " ", "simp", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "rei", "mple", "ment", "s", " ", "the", " ", "logic", " ", "for", " ", "handling", " ", "the", " ", "response", ",", " ", "most", " ", "of", " ", "this", " ", "code", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "take", "n", " ", "verba", "tim", ",", " ", "and", " ", "we", " ", "only", " ", "change", "d", " ", "the", " ", "path", " ", "tha", "t", " ", "we", " ", "redirec", "t", " ", "to", "._", "\\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_", "process", "\\u", "response_", "(_", "self_", ",_", "request_", ",_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "language_", "=_", "translation_", "._", "get", "\\u", "language_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "response_", "._", "status", "\\u", "code_", "==_", "404_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "not_", "translation_", "._", "get", "\\u", "language", "\\u", "from", "\\u", "path_", "(_", "request_", "._", "path", "\\u", "info_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "self_", "._", "is", "\\u", "language", "\\u", "prefix", "\\u", "pattern", "s", "\\u", "used_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url", "conf_", "=_", "getattr_", "(_", "request_", ",_", "'", "url", "conf", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "language", "\\u", "path_", "=_", "'/", "%", "s", "%", "s", "'_", "%_", "(_", "language_", ",_", "request_", "._", "path", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path", "\\u", "valid_", "=_", "is", "\\u", "valid", "\\u", "path_", "(_", "language", "\\u", "path_", ",_", "url", "conf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "not_", "path", "\\u", "valid_", "and_", "settings_", "._", "APPEN", "D", "\\u", "SLA", "SH_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "not_", "language", "\\u", "path_", "._", "endswith_", "(_", "'/'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path", "\\u", "valid_", "=_", "is", "\\u", "valid", "\\u", "path_", "(_", "\"%", "s", "/\"_", "%_", "language", "\\u", "path_", ",_", "url", "conf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "path", "\\u", "valid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", "=_", "request_", "._", "get", "\\u", "full", "\\u", "path_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "script", "\\u", "mount_", "=_", "request_", "._", "META_", "._", "get_", "(_", "\"", "SCRIPT", "\\u", "NAME", "\"_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "path_", "._", "startswith_", "(_", "script", "\\u", "mount_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "path_", "=_", "path_", "._", "replace_", "(_", "script", "\\u", "mount_", ",_", "(_", "\"%", "s", "/", "%", "s", "\"_", "%_", "(_", "script", "\\u", "mount_", ",_", "language_", ")_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "language", "\\u", "url_", "=_", "\"%", "s", "://", "%", "s", "%", "s", "\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "._", "is", "\\u", "secure_", "(_", ")_", "and_", "'", "https", "'_", "or_", "'", "http", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "._", "get", "\\u", "host_", "(_", ")_", ",_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "language", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "translation_", "._", "deactivate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "patch", "\\u", "vary", "\\u", "headers_", "(_", "response_", ",_", "(_", "'", "Accept", "-", "Lang", "ua", "ge", "'_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "Conten", "t", "-", "Lang", "ua", "ge", "'_", "not_", "in_", "response_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "[_", "'", "Conten", "t", "-", "Lang", "ua", "ge", "'_", "]_", "=_", "language_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "response_", "\\u\\u\\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_", "Spl", "unk", "Web", "Sess", "ion", "Middleware_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Spl", "unk", "Web", "Sess", "ion", "Middleware_", "(_", "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_", ",_", "port_", "=_", "8000_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "initialized_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "storage", "\\u", "path_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "settings_", "._", "SPL", "UNK", "\\u", "WEB", "\\u", "INTEG", "RAT", "ED_", ":_", "\\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 ", " _", "from_", "lib_", "._", "util_", "import_", "splu", "nk", "\\u", "to", "\\u", "cherr", "y", "\\u", "cfg_", ",_", "make", "\\u", "absolute_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cherr", "yp", "y", "\\u", "cfg_", "=_", "splu", "nk", "\\u", "to", "\\u", "cherr", "y", "\\u", "cfg_", "(_", "'", "web", "'_", ",_", "'", "settings", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "storage", "\\u", "type_", "=_", "cherr", "yp", "y", "\\u", "cfg_", "._", "get_", "(_", "'", "tool", "s", ".", "session", "s", ".", "storage", "\\u", "type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "storage", "\\u", "path_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "storage", "\\u", "type_", "==_", "'", "file", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "storage", "\\u", "path_", "=_", "make", "\\u", "absolute_", "(_", "cherr", "yp", "y", "\\u", "cfg_", "[_", "'", "tool", "s", ".", "session", "s", ".", "storage", "\\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 ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "storage", "\\u", "path_", "=_", "storage", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "initialized_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "initialized_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spl", "unk", "Web", "Sess", "ion", "Middleware_", "(_", "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_", "process", "\\u", "request_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "\\u", "initialized_", "or_", "not_", "self_", "._", "\\u", "storage", "\\u", "path_", ":_", "\\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_", "user_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "session_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "lib_", "._", "sessions_", "import_", "File", "Session_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cookie", "\\u", "name_", "=_", "'", "session", "\\u", "id", "\\u", "%", "s", "'_", "%_", "settings_", "._", "SPL", "UNK", "\\u", "WEB", "\\u", "PORT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cookie", "\\u", "name_", "not_", "in_", "request_", "._", "COOKIE", "S_", ":_", "\\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_", "splu", "nk", "web", "\\u", "cookie_", "=_", "request_", "._", "COOKIE", "S_", "[_", "cookie", "\\u", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "session_", "=_", "File", "Session_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "splu", "nk", "web", "\\u", "cookie_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "storage", "\\u", "path_", "=_", "self_", "._", "\\u", "storage", "\\u", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "timeout_", "=_", "60_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "clean", "\\u", "freq_", "=_", "5_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Acquire", " ", "the", " ", "lock", ".", " ", "If", " ", "this", " ", "fail", "s", ",", " ", "we", " ", "assume", " ", "tha", "t", " ", "the", " ", "lock", " ", "is", " ", "no_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "long", "er", " ", "acquired", ",", " ", "and", " ", "thu", "s", " ", "doe", "s", " ", "not", " ", "need", " ", "to", " ", "be", " ", "released", ".", " ", "Any", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "future", " ", "use", " ", "is", " ", "protect", "ed", " ", "by", " ", "the", " ", "try", "/", "final", "ly", " ", "whi", "ch", " ", "will", " ", "release_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "lock", " ", "whe", "n", " ", "it", " ", "is", " ", "complete", "._", "\\u\\u\\uNL\\u\\u\\u_", "session_", "._", "acquir", "e\\u", "lock_", "(_", "read", "\\u", "lock_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "DO", " ", "NOT", " ", "PU", "T", " ", "ANY", "THI", "NG", " ", "HER", "E", ".", " ", "ALL", " ", "CODE", " ", "SHO", "UL", "D", " ", "BE", " ", "INS", "IDE", " ", "THE", " ", "TR", "Y", "/", "FINAL", "LY", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "SO", " ", "THA", "T", " ", "WE", " ", "CAN", " ", "ENS", "URE", " ", "THE", " ", "SES", "SION", " ", "LOCK", " ", "GET", "S", " ", "RELEASE", "D", "._", "\\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 ", " _", "if_", "'", "session", "Key", "'_", "in_", "session_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "session", "\\u", "key_", "=_", "\"", "Spl", "unk", " ", "%", "s", "\"_", "%_", "session_", "[_", "'", "session", "Key", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "username_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "user", "'_", "in_", "session_", "and_", "'", "name", "'_", "in_", "session_", "[_", "'", "user", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "username_", "=_", "session_", "[_", "'", "user", "'_", "]_", "[_", "'", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "user_", "=_", "get", "\\u", "user_", "(_", "username_", ",_", "session", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "user_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "request_", "._", "\\u", "cache", "d\\u", "user_", "=_", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "we", " ", "fail", "ed", " ", "to", " ", "create", " ", "a", " ", "user", ",", " ", "and", " ", "we", " ", "have", " ", "a", " ", "session", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "then", " ", "we", " ", "need", " ", "to", " ", "delete", " ", "the", " ", "session", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "main", " ", "reason", " ", "is", " ", "tha", "t", " ", "if", " ", "we", " ", "don", "'", "t", " ", "have", " ", "a", " ", "user", ",", " ", "it", " ", "means_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "are", " ", "not", " ", "authenticat", "ed", ".", " ", "If", " ", "we", " ", "are", "n", "'", "t", " ", "authenticat", "ed", ",", " ", "we", "'", "ll_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "redirected", " ", "to", " ", "Spl", "unk", "web", "'", "s", " ", "login", " ", "page", ",", " ", "whi", "ch", " ", "will", " ", "just", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "redirec", "t", " ", "us", " ", "back", " ", "if", " ", "a", " ", "session", "Key", " ", "value", " ", "exist", "s", " ", "(", "whe", "ther", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "valid", " ", "or", " ", "not", ").", " ", "We", " ", "then", " ", "get", " ", "int", "o", " ", "an", " ", "infini", "te", " ", "redirec", "t", " ", "loop", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "as", " ", "we", "'", "ll", " ", "just", " ", "come", " ", "back", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "user_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "session_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Release", " ", "the", " ", "lock_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "session_", "._", "release", "\\u", "lock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "exception_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Spl", "unk", "Dj", "ang", "o", "Request", "Log", "ging", "Middleware_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error", "\\u", "logger_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "access", "\\u", "logger_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "access", "\\u", "log", "\\u", "format_", "=_", "'%", "(", "h", ")", "s", " ", "%", "(", "l", ")", "s", " ", "%", "(", "u", ")", "s", " ", "%", "(", "t", ")", "s", " ", "\"%", "(", "r", ")", "s", "\"", " ", "%", "(", "s", ")", "s", " ", "%", "(", "b", ")", "s", " ", "\"%", "(", "f", ")", "s", "\"", " ", "\"%", "(", "a", ")", "s", "\"'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Spl", "unk", "Dj", "ang", "o", "Request", "Log", "ging", "Middleware_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "access", "\\u", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "'", "spl", ".", "django", ".", "access", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "error", "\\u", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "'", "spl", ".", "django", ".", "error", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spl", "unk", "Dj", "ang", "o", "Request", "Log", "ging", "Middleware_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "process", "\\u", "response_", "(_", "self_", ",_", "request_", ",_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Write", " ", "to", " ", "the", " ", "access", " ", "log", " ", "(", "in", " ", "Ap", "ache", "/", "NC", "SA", " ", "Combine", "d", " ", "Log", " ", "format", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "a", " ", "port", " ", "of", " ", "the", " ", "Spl", "unk", " ", "web", "\\u", "access", " ", "logg", "ing", " ", "code", ".", " ", "It", " ", "is", " ", "a", " ", "rough", "\\", "10", ";", " ", " ", " ", " ", "mapping", " ", "of", " ", "request", " ", "object", "s", " ", "in", " ", "the", " ", "splu", "nk", " ", "web", " ", "cherr", "yp", "y", " ", "server", " ", "to", " ", "equivalent", "\\", "10", ";", " ", " ", " ", " ", "object", "s", " ", "in", " ", "the", " ", "django", " ", "environ", "ment", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "atoms_", "=_", "{_", "'", "h", "'_", ":_", "request_", "._", "META_", "._", "get_", "(_", "'", "REMO", "TE", "\\u", "ADDR", "'_", ",_", "''_", ")_", ",_", "#", " ", "or", " ", "REMO", "TE", "\\u", "HOST_", "\\u\\u\\uNL\\u\\u\\u_", "'", "l", "'_", ":_", "'-'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "u", "'_", ":_", "getattr_", "(_", "request_", ",_", "'", "user", "'_", ",_", "'-'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "t", "'_", ":_", "self_", "._", "access", "\\u", "time_", "(_", "time_", "._", "time_", "(_", ")_", ")_", ",_", "#", "TOD", "O", ":", " ", "splu", "nk", "web", " ", "use", "s", " ", "cherr", "yp", "y", ".", "serving", ".", "response", ".", "time_", "\\u\\u\\uNL\\u\\u\\u_", "'", "r", "'_", ":_", "\"%", "s", " ", "%", "s", " ", "%", "s", "\"_", "%_", "(_", "request_", "._", "method_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "._", "get", "\\u", "full", "\\u", "path_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "._", "META_", "._", "get_", "(_", "'", "SERVER", "\\u", "PROTOCOL", "'_", ",_", "''_", ")_", ")_", ",_", "#", "or", " ", "ACT", "UAL", "\\u", "SERVER", "\\u", "PROTOCOL_", "\\u\\u\\uNL\\u\\u\\u_", "'", "s", "'_", ":_", "response_", "._", "status", "\\u", "code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "b", "'_", ":_", "len_", "(_", "response_", "._", "content_", ")_", "or_", "'-'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "f", "'_", ":_", "request_", "._", "META_", "._", "get_", "(_", "'", "HTTP", "\\u", "REFE", "RER", "'_", ",_", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "a", "'_", ":_", "request_", "._", "META_", "._", "get_", "(_", "'", "HTTP", "\\u", "USER", "\\u", "AGE", "NT", "'_", ",_", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "atoms_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "v_", ",_", "unicode_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "v_", "._", "encode_", "(_", "'", "utf", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "isinstance_", "(_", "v_", ",_", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "str_", "(_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fort", "unat", "el", "y", ",", " ", "repr", "(", "str", ")", " ", "escape", "s", " ", "unpr", "inta", "ble", " ", "char", "s", ",", " ", "\\\\", "n", ",", " ", "\\\\", "t", ",", " ", "etc", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "backslash", " ", "for", " ", "us", ".", " ", "All", " ", "we", " ", "have", " ", "to", " ", "do", " ", "is", " ", "strip", " ", "the", " ", "quote", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "v_", "=_", "repr_", "(_", "v_", ")_", "[_", "1_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Esc", "ape", " ", "double", "-", "quote", "._", "\\u\\u\\uNL\\u\\u\\u_", "atoms_", "[_", "k_", "]_", "=_", "v_", "._", "replace_", "(_", "'\"'_", ",_", "'\\\\\\\\", "\"'_", ")_", "\\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_", "#", "TOD", "O", ":", " ", "add", " ", "a", " ", "response", " ", "id", " ", "and", " ", "time", " ", "here", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "access", "\\u", "logger_", "._", "info_", "(_", "self_", "._", "access", "\\u", "log", "\\u", "format_", "%_", "atoms_", ")_", "\\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 ", " _", "error", "\\u", "logger_", "._", "log_", "(_", "\"", "Error", " ", "writ", "ing", " ", "access", " ", "log", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "(_", "traceback_", "=_", "true_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spl", "unk", "Dj", "ang", "o", "Request", "Log", "ging", "Middleware_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "access", "\\u", "time_", "(_", "self_", ",_", "req", "\\u", "time_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "now_", "=_", "datetime_", "._", "datetime_", "._", "fromtimestamp_", "(_", "req", "\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "month_", "=_", "rfc", "822", "_", "._", "\\u", "month", "names_", "[_", "now_", "._", "month_", "-_", "1_", "]_", "._", "capitalize_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "'[", "%", "02", "d", "/", "%", "s", "/", "%", "04", "d", ":", "%", "02", "d", ":", "%", "02", "d", ":", "%", "02", "d", ".", "%", "03", "d", " ", "%", "s", "]'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "now_", "._", "day_", ",_", "month_", ",_", "now_", "._", "year_", ",_", "now_", "._", "hour_", ",_", "now_", "._", "minute_", ",_", "now_", "._", "second_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "now_", "._", "microsecond_", "/_", "1000_", ",_", "format\\u", "local", "\\u", "tz", "offset_", "(_", "req", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
azoft-dev-team/imagrium/env/Lib/xml/sax/__init__.py
[ { "content": "\"\"\"Simple API for XML (SAX) implementation for Python.\n\nThis module provides an implementation of the SAX 2 interface;\ninformation about the Java version of the interface can be found at\nhttp://www.megginson.com/SAX/. The Python version of the interface is\ndocumented at <...>.\n\nThis package contains the following modules:\n\nhandler -- Base classes and constants which define the SAX 2 API for\n the 'client-side' of SAX for Python.\n\nsaxutils -- Implementation of the convenience classes commonly used to\n work with SAX.\n\nxmlreader -- Base classes and constants which define the SAX 2 API for\n the parsers used with SAX for Python.\n\ndrivers2 -- Contains the driver for that wraps a Java sax implementation in python\n objects.\n\"\"\"\n\nfrom xmlreader import InputSource\nfrom handler import ContentHandler, ErrorHandler\nfrom _exceptions import SAXException, SAXNotRecognizedException, \\\n SAXParseException, SAXNotSupportedException, \\\n SAXReaderNotAvailable\n\n\n\n\n# this is the parser list used by the make_parser function if no\n# alternatives are given as parameters to the function\n\ndefault_parser_list = [\"xml.sax.drivers2.drv_javasax\"]\n\n# tell modulefinder that importing sax potentially imports expatreader\n_false = 0\nif _false:\n import xml.sax.drivers2.drv_javasax\n\nimport os, sys\nif os.environ.has_key(\"PY_SAX_PARSER\"):\n default_parser_list = os.environ[\"PY_SAX_PARSER\"].split(\",\")\ndel os\n\n_key = \"python.xml.sax.parser\"\nif sys.platform[:4] == \"java\" and sys.registry.containsKey(_key):\n default_parser_list = sys.registry.getProperty(_key).split(\",\")\n\n\n\n# --- Internal utility methods used by make_parser\n\n\ndel sys\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def parse(source, handler, errorHandler=ErrorHandler()):\n parser = make_parser()\n parser.setContentHandler(handler)\n parser.setErrorHandler(errorHandler)\n parser.parse(source)", "metadata": "root.parse", "header": "['module', '___EOS___']", "index": 29 }, { "content": "def parseString(string, handler, errorHandler=ErrorHandler()):\n try:\n from cStringIO import StringIO\n except ImportError:\n from StringIO import StringIO\n\n if errorHandler is None:\n errorHandler = ErrorHandler()\n parser = make_parser()\n parser.setContentHandler(handler)\n parser.setErrorHandler(errorHandler)\n\n inpsrc = InputSource()\n inpsrc.setByteStream(StringIO(string))\n parser.parse(inpsrc)", "metadata": "root.parseString", "header": "['module', '___EOS___']", "index": 35 }, { "content": "def make_parser(parser_list = []):\n \"\"\"Creates and returns a SAX parser.\n\n Creates the first parser it is able to instantiate of the ones\n given in the list created by doing parser_list +\n default_parser_list. The lists must contain the names of Python\n modules containing both a SAX parser and a create_parser function.\"\"\"\n\n for parser_name in parser_list + default_parser_list:\n try:\n return _create_parser(parser_name)\n except ImportError,e:\n import sys\n if sys.modules.has_key(parser_name):\n # The parser module was found, but importing it\n # failed unexpectedly, pass this exception through\n raise\n except SAXReaderNotAvailable:\n # The parser module detected that it won't work properly,\n # so try the next one\n pass\n\n raise SAXReaderNotAvailable(\"No parsers found\", None)", "metadata": "root.make_parser", "header": "['module', '___EOS___']", "index": 71 }, { "content": "def _create_parser(parser_name):\n drv_module = __import__(parser_name,{},{},['create_parser'])\n return drv_module.create_parser()", "metadata": "root._create_parser", "header": "['module', '___EOS___']", "index": 97 } ]
[ { "span": "from handler import ContentHandler, ErrorHandler", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 48 }, { "span": "from _exceptions import SAXException, SAXNotRecognizedException, \\\n SAXParseException, SAXNotSupportedException, \\\n SAXReaderNotAvailable", "start_line": 24, "start_column": 0, "end_line": 26, "end_column": 45 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "Simple", " ", "API", " ", "for", " ", "XML", " ", "(", "SA", "X", ")", " ", "implementation", " ", "for", " ", "Pyth", "on", ".", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "module", " ", "provide", "s", " ", "an", " ", "implementation", " ", "of", " ", "the", " ", "SA", "X", " ", "2", " ", "interface", ";", "\\", "10", ";", "informati", "on", " ", "abo", "ut", " ", "the", " ", "Ja", "va", " ", "version", " ", "of", " ", "the", " ", "interface", " ", "can", " ", "be", " ", "found", " ", "at", "\\", "10", ";", "http", "://", "www", ".", "me", "ggi", "nso", "n", ".", "com", "/", "SA", "X", "/.", " ", " ", "The", " ", "Pyth", "on", " ", "version", " ", "of", " ", "the", " ", "interface", " ", "is", "\\", "10", ";", "documente", "d", " ", "at", " ", "<", "...", ">.", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "package", " ", "contain", "s", " ", "the", " ", "follow", "ing", " ", "module", "s", ":", "\\", "10", ";", "\\", "10", ";", "handler", " ", "--", " ", "Base", " ", "classe", "s", " ", "and", " ", "constant", "s", " ", "whi", "ch", " ", "defin", "e", " ", "the", " ", "SA", "X", " ", "2", " ", "API", " ", "for", "\\", "10", ";", " ", " ", " ", "the", " ", "'", "client", "-", "side", "'", " ", "of", " ", "SA", "X", " ", "for", " ", "Pyth", "on", ".", "\\", "10", ";", "\\", "10", ";", "sax", "util", "s", " ", "--", " ", "Implementation", " ", "of", " ", "the", " ", "convenien", "ce", " ", "classe", "s", " ", "common", "ly", " ", "used", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "work", " ", "with", " ", "SA", "X", ".", "\\", "10", ";", "\\", "10", ";", "xml", "reader", " ", "--", " ", "Base", " ", "classe", "s", " ", "and", " ", "constant", "s", " ", "whi", "ch", " ", "defin", "e", " ", "the", " ", "SA", "X", " ", "2", " ", "API", " ", "for", "\\", "10", ";", " ", " ", " ", " ", " ", "the", " ", "parser", "s", " ", "used", " ", "with", " ", "SA", "X", " ", "for", " ", "Pyth", "on", ".", "\\", "10", ";", "\\", "10", ";", "driver", "s2", " ", "--", " ", "Contain", "s", " ", "the", " ", "driver", " ", "for", " ", "tha", "t", " ", "wrap", "s", " ", "a", " ", "Ja", "va", " ", "sax", " ", "implementation", " ", "in", " ", "python", "\\", "10", ";", " ", " ", " ", " ", "object", "s", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "xml", "reader_", "import_", "Inp", "ut", "Source_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "handler_", "import_", "Conten", "t", "Handler_", ",_", "Error", "Handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "\\u", "exceptions_", "import_", "SA", "XE", "xcept", "ion_", ",_", "SA", "XN", "ot", "Recognize", "d", "Exception_", ",_", "SA", "XP", "arse", "Exception_", ",_", "SA", "XN", "ot", "Supp", "orte", "d", "Exception_", ",_", "SA", "XR", "eader", "Not", "Available_", "\\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_", "#", " ", "this", " ", "is", " ", "the", " ", "parser", " ", "list", " ", "used", " ", "by", " ", "the", " ", "make", "\\u", "parser", " ", "function", " ", "if", " ", "no_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "alternatives", " ", "are", " ", "give", "n", " ", "as", " ", "parameter", "s", " ", "to", " ", "the", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "default", "\\u", "parser", "\\u", "list_", "=_", "[_", "\"", "xml", ".", "sax", ".", "driver", "s2", ".", "drv", "\\u", "java", "sax", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tell", " ", "module", "finde", "r", " ", "tha", "t", " ", "import", "ing", " ", "sax", " ", "potenti", "ally", " ", "import", "s", " ", "expa", "trea", "der_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "false_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "false_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "xml_", "._", "sax_", "._", "driver", "s2_", "._", "drv", "\\u", "java", "sax_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "os_", ",_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "environ_", "._", "has", "\\u", "key_", "(_", "\"", "PY", "\\u", "SA", "X", "\\u", "PARSE", "R", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "default", "\\u", "parser", "\\u", "list_", "=_", "os_", "._", "environ_", "[_", "\"", "PY", "\\u", "SA", "X", "\\u", "PARSE", "R", "\"_", "]_", "._", "split_", "(_", "\",\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "key_", "=_", "\"", "python", ".", "xml", ".", "sax", ".", "parser", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sys_", "._", "platform_", "[_", ":_", "4_", "]_", "==_", "\"", "java", "\"_", "and_", "sys_", "._", "registry_", "._", "contain", "s", "Key_", "(_", "\\u", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "default", "\\u", "parser", "\\u", "list_", "=_", "sys_", "._", "registry_", "._", "get", "Property_", "(_", "\\u", "key_", ")_", "._", "split_", "(_", "\",\"_", ")_", "\\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_", "#", " ", "---", " ", "Intern", "al", " ", "utility", " ", "method", "s", " ", "used", " ", "by", " ", "make", "\\u", "parser_", "\\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_", "del_", "sys_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "parse_", "(_", "source_", ",_", "handler_", ",_", "error", "Handler_", "=_", "Error", "Handler_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parser_", "=_", "make", "\\u", "parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "set", "Conten", "t", "Handler_", "(_", "handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "set", "Error", "Handler_", "(_", "error", "Handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "parse_", "(_", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "String_", "(_", "string_", ",_", "handler_", ",_", "error", "Handler_", "=_", "Error", "Handler_", "(_", ")_", ")_", ":_", "\\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 ", " _", "from_", "c", "String", "IO_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "String", "IO_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "error", "Handler_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error", "Handler_", "=_", "Error", "Handler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "parser_", "=_", "make", "\\u", "parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "set", "Conten", "t", "Handler_", "(_", "handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "set", "Error", "Handler_", "(_", "error", "Handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "inp", "src_", "=_", "Inp", "ut", "Source_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inp", "src_", "._", "set", "Byte", "Stream_", "(_", "String", "IO_", "(_", "string_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "parse_", "(_", "inp", "src_", ")_", "\\u\\u\\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_", "make", "\\u", "parser_", "(_", "parser", "\\u", "list_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "es", " ", "and", " ", "return", "s", " ", "a", " ", "SA", "X", " ", "parser", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Creat", "es", " ", "the", " ", "first", " ", "parser", " ", "it", " ", "is", " ", "able", " ", "to", " ", "instantiate", " ", "of", " ", "the", " ", "ones", "\\", "10", ";", " ", " ", " ", " ", "give", "n", " ", "in", " ", "the", " ", "list", " ", "created", " ", "by", " ", "doi", "ng", " ", "parser", "\\u", "list", " ", "+", "\\", "10", ";", " ", " ", " ", " ", "default", "\\u", "parser", "\\u", "list", ".", " ", " ", "The", " ", "lists", " ", "must", " ", "contain", " ", "the", " ", "names", " ", "of", " ", "Pyth", "on", "\\", "10", ";", " ", " ", " ", " ", "module", "s", " ", "contain", "ing", " ", "bot", "h", " ", "a", " ", "SA", "X", " ", "parser", " ", "and", " ", "a", " ", "create", "\\u", "parser", " ", "function", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "parser", "\\u", "name_", "in_", "parser", "\\u", "list_", "+_", "default", "\\u", "parser", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "create", "\\u", "parser_", "(_", "parser", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sys_", "._", "modules_", "._", "has", "\\u", "key_", "(_", "parser", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "parser", " ", "module", " ", "was", " ", "found", ",", " ", "but", " ", "import", "ing", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fail", "ed", " ", "unexpected", "ly", ",", " ", "pass", " ", "this", " ", "exception", " ", "through_", "\\u\\u\\uNL\\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_", "except_", "SA", "XR", "eader", "Not", "Available_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "parser", " ", "module", " ", "detect", "ed", " ", "tha", "t", " ", "it", " ", "won", "'", "t", " ", "work", " ", "proper", "ly", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "so", " ", "try", " ", "the", " ", "next", " ", "one_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "SA", "XR", "eader", "Not", "Available_", "(_", "\"", "No", " ", "parser", "s", " ", "found", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "create", "\\u", "parser_", "(_", "parser", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "drv", "\\u", "module_", "=_", "\\u\\u", "import\\u\\u_", "(_", "parser", "\\u", "name_", ",_", "{_", "}_", ",_", "{_", "}_", ",_", "[_", "'", "create", "\\u", "parser", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "drv", "\\u", "module_", "._", "create", "\\u", "parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Except block handles 'BaseException'
GoogleCloudPlatform/python-compat-runtime/appengine-compat/exported_appengine_sdk/google/appengine/tools/appcfg.py
[ { "content": " def LogClientDeploy(self, runtime, start_time_usec, success):\n \"\"\"Logs a client deployment attempt.\n\n Args:\n runtime: The runtime for the app being deployed.\n start_time_usec: The start time of the deployment in micro seconds.\n success: True if the deployment succeeded otherwise False.\n \"\"\"\n if not self.usage_reporting:\n logging.info('Skipping usage reporting.')\n return\n end_time_usec = self.GetCurrentTimeUsec()\n try:\n info = client_deployinfo.ClientDeployInfoExternal(\n runtime=runtime,\n start_time_usec=start_time_usec,\n end_time_usec=end_time_usec,\n requests=self.requests,\n success=success,\n sdk_version=self.GetSdkVersion())\n self.Send('/api/logclientdeploy', info.ToYAML())\n except BaseException, e:\n logging.debug('Exception logging deploy info continuing - %s', e)", "metadata": "root._ClientDeployLoggingContext.LogClientDeploy", "header": "['class', '_ClientDeployLoggingContext', '(', 'object', ')', ':', '___EOS___']", "index": 1730 } ]
[ { "span": "except BaseException, e:", "start_line": 1751, "start_column": 4, "end_line": 1751, "end_column": 28 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "\\u", "Client", "Deploy", "Log", "ging", "Context_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Log", "Client", "Deploy", "_", "(_", "self_", ",_", "runtime_", ",_", "start", "\\u", "time", "\\u", "usec", "_", ",_", "success_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Log", "s", " ", "a", " ", "client", " ", "deploy", "ment", " ", "atte", "mpt", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "runt", "ime", ":", " ", "The", " ", "runt", "ime", " ", "for", " ", "the", " ", "app", " ", "bei", "ng", " ", "deploye", "d", ".", "\\", "10", ";", " ", " ", "start", "\\u", "time", "\\u", "usec", ":", " ", "The", " ", "start", " ", "time", " ", "of", " ", "the", " ", "deploy", "ment", " ", "in", " ", "micro", " ", "second", "s", ".", "\\", "10", ";", " ", " ", "success", ":", " ", "Tru", "e", " ", "if", " ", "the", " ", "deploy", "ment", " ", "succe", "eded", " ", "other", "wis", "e", " ", "Fal", "se", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "usage", "\\u", "reporting", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "info_", "(_", "'", "Ski", "ppi", "ng", " ", "usage", " ", "reporting", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "end", "\\u", "time", "\\u", "usec", "_", "=_", "self_", "._", "Get", "Curr", "ent", "Time", "Us", "ec_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info_", "=_", "client", "\\u", "deploy", "info_", "._", "Client", "Deploy", "Info", "Exter", "nal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "runtime_", "=_", "runtime_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start", "\\u", "time", "\\u", "usec", "_", "=_", "start", "\\u", "time", "\\u", "usec", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "end", "\\u", "time", "\\u", "usec", "_", "=_", "end", "\\u", "time", "\\u", "usec", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "requests_", "=_", "self_", "._", "requests_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "success_", "=_", "success_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sd", "k", "\\u", "version_", "=_", "self_", "._", "Get", "Sd", "k", "Version_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Send_", "(_", "'/", "api", "/", "logc", "lien", "tde", "plo", "y", "'_", ",_", "info_", "._", "To", "YAM", "L_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Base", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "debug_", "(_", "'", "Except", "ion", " ", "logg", "ing", " ", "deploy", " ", "info", " ", "continui", "ng", " ", "-", " ", "%", "s", "'_", ",_", "e_", ")_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
cjerdonek/open-rcv/openrcv/scripts/run.py
[ { "content": "#\n# Copyright (c) 2014 Chris Jerdonek. All rights reserved.\n#\n# Permission is hereby granted, free of charge, to any person obtaining a\n# copy of this software and associated documentation files (the \"Software\"),\n# to deal in the Software without restriction, including without limitation\n# the rights to use, copy, modify, merge, publish, distribute, sublicense,\n# and/or sell copies of the Software, and to permit persons to whom the\n# Software is furnished to do so, subject to the following conditions:\n#\n# The above copyright notice and this permission notice shall be included\n# in 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\n# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n# DEALINGS IN THE SOFTWARE.\n#\n\nimport argparse2 as argparse\nfrom contextlib import contextmanager\nimport logging\nimport os\nimport sys\nfrom textwrap import dedent\nfrom traceback import format_exc\n\nimport colorlog\n\nfrom openrcv.scripts.argparse import (parse_log_level, HelpRequested,\n UsageException)\n\n\nEXIT_STATUS_SUCCESS = 0\nEXIT_STATUS_FAIL = 1\nEXIT_STATUS_USAGE_ERROR = 2\n\nPROG_NAME = os.path.basename(sys.argv[0])\n\nlog = logging.getLogger(PROG_NAME)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n# TODO: test the UsageException code path.\n\n\n# We follow most of Guido van Rossum's 2003 advice regarding main()\n# functions (though we choose _main() as the function that returns an exit\n# status rather than main()):\n# http://www.artima.com/weblogs/viewpost.jsp?thread=4829\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class DisplayNameFilter(object):\n\n \"\"\"A logging filter that sets display_name.\"\"\"\n", "metadata": "root.DisplayNameFilter", "header": "['module', '___EOS___']", "index": 45 }, { "content": " def filter(self, record):\n record.display_name = record.name\n return True", "metadata": "root.DisplayNameFilter.filter", "header": "['class', 'DisplayNameFilter', '(', 'object', ')', ':', '___EOS___']", "index": 49 }, { "content": "class TruncatedDisplayNameFilter(object):\n\n \"\"\"A logging filter that sets a truncated display_name.\"\"\"\n", "metadata": "root.TruncatedDisplayNameFilter", "header": "['module', '___EOS___']", "index": 54 }, { "content": " def filter(self, record):\n parts = record.name.split(\".\")\n if len(parts) <= 3:\n display_name = record.name\n else:\n # For example, \"a.b.c.d\" becomes \"a.b...d\".\n display_name = '.'.join(parts[:2] + ['.', parts[-1]])\n record.display_name = display_name\n return True", "metadata": "root.TruncatedDisplayNameFilter.filter", "header": "['class', 'TruncatedDisplayNameFilter', '(', 'object', ')', ':', '___EOS___']", "index": 58 }, { "content": "def get_filter(level):\n if level <= logging.DEBUG:\n cls = DisplayNameFilter\n else:\n cls = TruncatedDisplayNameFilter\n return cls()", "metadata": "root.get_filter", "header": "['module', '___EOS___']", "index": 69 }, { "content": "def make_formatter():\n # Prefix log messages unobtrusively with \"log\" to distinguish log\n # messages more obviously from other text sent to the error stream.\n format_string = (\"%(bg_black)s%(log_color)slog: %(display_name)s: \"\n \"[%(levelname)s]%(reset)s %(message)s\")\n colors = colorlog.default_log_colors\n colors['DEBUG'] = 'white'\n formatter = colorlog.ColoredFormatter(format_string, log_colors=colors)\n return formatter", "metadata": "root.make_formatter", "header": "['module', '___EOS___']", "index": 77 }, { "content": "def make_log_handler(level, file_=None):\n if file_ is None:\n file_ = sys.stderr\n\n # If file_ is None, StreamHandler uses sys.stderr.\n handler = logging.StreamHandler(file_)\n # TODO: can we delete this code comment? Is there any reason\n # to set this handler to a level different from the root logger?\n #handler.setLevel(level)\n\n filter_ = get_filter(level)\n handler.addFilter(filter_)\n\n formatter = make_formatter()\n handler.setFormatter(formatter)\n\n return handler", "metadata": "root.make_log_handler", "header": "['module', '___EOS___']", "index": 87 }, { "content": "@contextmanager\ndef log_config(level, file_=None):\n \"\"\"\n A context manager to configure logging and then undo the configuration.\n\n Undoing the configuration is useful for testing, since otherwise\n many log handlers might accumulate during the course of testing,\n due to successive calls to this method.\n\n Arguments:\n\n level: lowest logging level to log.\n file_: the file object to use for logging (e.g. sys.stderr).\n\n \"\"\"\n if level is None:\n level = LOG_LEVEL_DEFAULT\n root = logging.getLogger()\n # If logging was already configured (e.g. at the outset of a test run),\n # then let's not change the root logging level.\n # TODO: simplify this logic (e.g. we should not need \"if\" logic).\n already_configured = root.hasHandlers()\n handler = make_log_handler(level, file_=file_)\n root.addHandler(handler)\n if not already_configured:\n root.setLevel(level)\n log.debug(\"root logger level set to: %r\" % logging.getLevelName(level))\n log.debug(\"a logging handler was added\")\n yield\n root.removeHandler(handler)", "metadata": "root.log_config", "header": "['module', '___EOS___']", "index": 106 }, { "content": "def make_usage_error(msg, help_options):\n text = dedent(\"\"\"\\\n Command-line usage error: {!s}\n\n Pass {!s} for help documentation and available options.\"\"\").format(msg, help_options)\n return text", "metadata": "root.make_usage_error", "header": "['module', '___EOS___']", "index": 138 }, { "content": "def print_usage_error(parser, msg, file_=None):\n if file_ is None:\n file_ = sys.stderr\n if len(sys.argv) == 1:\n parser.print_help()\n parser.print_usage(file_)\n text = make_usage_error(msg, parser.option_help.display(' or '))\n log.error(text)", "metadata": "root.print_usage_error", "header": "['module', '___EOS___']", "index": 146 }, { "content": "def non_exiting_main(parser, argv, stdout=None, log_file=None):\n \"\"\"\n Run the program, and return the exit status without exiting.\n\n Arguments:\n parser: an argparse.ArgumentParser object.\n\n \"\"\"\n args = argv[1:]\n log_level = parser.safe_get_log_level(args)\n\n if stdout is None:\n stdout = sys.stdout\n with log_config(level=log_level, file_=log_file):\n log.debug(\"argv: %r\" % argv)\n try:\n ns = parser.parse_args(args=args) # Namespace object\n log.debug(\"ns: %r\" % ns)\n # Make no args default to running help.\n try:\n # There seems to be a bug in argparse where the parent\n # parser's default run_command is used for args like\n # \"rcv randcontest\" (when nothing is after randcontest),\n # when parser.set_defaults(run_command=...) is used to set\n # the default on the parent parser. Thus we use try-except\n # here instead. I believe this is the issue:\n # http://bugs.python.org/issue9351\n command = ns.run_command\n except AttributeError:\n raise HelpRequested(parser=parser)\n output = command(ns, stdout=stdout)\n if output is not None:\n stdout.write(output)\n status = EXIT_STATUS_SUCCESS\n except HelpRequested as exc:\n parser = exc.parser\n parser.print_help(file=stdout)\n status = EXIT_STATUS_SUCCESS\n except UsageException as exc:\n # As of Python 3.4, argparse.ArgumentParser's error() implementation\n # looked like this--\n # self.print_usage(_sys.stderr)\n # args = {'prog': self.prog, 'message': message}\n # self.exit(2, _('%(prog)s: error: %(message)s\\n') % args)\n err_args, parser = exc.args, exc.parser\n assert len(err_args) == 1\n print_usage_error(parser, err_args[0], file_=log_file)\n status = EXIT_STATUS_USAGE_ERROR\n # TODO: decide whether to handle the error case manually, or let\n # Python do it by default. One problem with the former\n # is that exceptions don't show up during test failures.\n # except Exception as err:\n #\n # # Log the full exception info for \"unexpected\" exceptions.\n # log.error(format_exc())\n # status = EXIT_STATUS_FAIL\n\n return status", "metadata": "root.non_exiting_main", "header": "['module', '___EOS___']", "index": 157 }, { "content": "def main(parser, argv=None):\n if argv is None:\n argv = sys.argv\n status = non_exiting_main(parser, argv)\n sys.exit(status)", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 221 } ]
[ { "span": "import argparse2 as argparse", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 28 }, { "span": "from traceback import format_exc", "start_line": 28, "start_column": 0, "end_line": 28, "end_column": 32 }, { "span": "from openrcv.scripts.argparse import (parse_log_level, HelpRequested,\n UsageException)", "start_line": 32, "start_column": 0, "end_line": 33, "end_column": 53 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2014", " ", "Chr", "is", " ", "Jer", "don", "ek", ".", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\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_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "copy", " ", "of", " ", "this", " ", "software", " ", "and", " ", "associate", "d", " ", "documentation", " ", "files", " ", "(", "the", " ", "\"", "Sof", "twa", "re", "\")", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "deal", " ", "in", " ", "the", " ", "Sof", "twa", "re", " ", "with", "out", " ", "restriction", ",", " ", "inclu", "ding", " ", "with", "out", " ", "limit", "ation_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "rights", " ", "to", " ", "use", ",", " ", "copy", ",", " ", "modif", "y", ",", " ", "merge", ",", " ", "publi", "sh", ",", " ", "distribute", ",", " ", "subli", "cens", "e", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", "/", "or", " ", "sell", " ", "copie", "s", " ", "of", " ", "the", " ", "Sof", "twa", "re", ",", " ", "and", " ", "to", " ", "permit", " ", "person", "s", " ", "to", " ", "who", "m", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sof", "twa", "re", " ", "is", " ", "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", " ", "included_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "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_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THE", " ", "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_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FROM", ",", " ", "OUT", " ", "OF", " ", "OR", " ", "IN", " ", "CONNECTION", " ", "WITH", " ", "THE", " ", "SOFT", "WARE", " ", "OR", " ", "THE", " ", "USE", " ", "OR", " ", "OTHER", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "DEA", "LING", "S", " ", "IN", " ", "THE", " ", "SOFT", "WARE", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "argp", "arse", "2_", "as_", "argparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "contextlib_", "import_", "contextmanager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "textwrap_", "import_", "dedent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "traceback_", "import_", "format\\u", "exc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "color", "log_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "open", "rcv", "_", "._", "scripts_", "._", "argparse_", "import_", "(_", "parse", "\\u", "log", "\\u", "level_", ",_", "Help", "Requeste", "d_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Us", "age", "Exception_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "EXIT", "\\u", "STATUS", "\\u", "SUCCESS_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EXIT", "\\u", "STATUS", "\\u", "FAIL_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EXIT", "\\u", "STATUS", "\\u", "USAGE", "\\u", "ERROR_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "PROG", "\\u", "NAME_", "=_", "os_", "._", "path_", "._", "basename_", "(_", "sys_", "._", "argv_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "=_", "logging_", "._", "get", "Logger_", "(_", "PROG", "\\u", "NAME_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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\\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_", "#", " ", "TOD", "O", ":", " ", "test", " ", "the", " ", "Us", "age", "Except", "ion", " ", "code", " ", "path", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "follow", " ", "most", " ", "of", " ", "Guid", "o", " ", "van", " ", "Ros", "sum", "'", "s", " ", "2003", " ", "advi", "ce", " ", "regarding", " ", "main", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "function", "s", " ", "(", "tho", "ugh", " ", "we", " ", "choose", " ", "\\u", "main", "()", " ", "as", " ", "the", " ", "function", " ", "tha", "t", " ", "return", "s", " ", "an", " ", "exit_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "status", " ", "rat", "her", " ", "than", " ", "main", "())", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "www", ".", "arti", "ma", ".", "com", "/", "web", "logs", "/", "view", "post", ".", "jsp", "?", "thread", "=", "482", "9_", "\\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_", "Display", "Name", "Filter_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "logg", "ing", " ", "filter", " ", "tha", "t", " ", "sets", " ", "display", "\\u", "name", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Display", "Name", "Filter_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "filter_", "(_", "self_", ",_", "record_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "record_", "._", "display", "\\u", "name_", "=_", "record_", "._", "name_", "\\u\\u\\uNEWLINE\\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_", "Truncate", "d", "Display", "Name", "Filter_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "logg", "ing", " ", "filter", " ", "tha", "t", " ", "sets", " ", "a", " ", "truncat", "ed", " ", "display", "\\u", "name", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Truncate", "d", "Display", "Name", "Filter_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "filter_", "(_", "self_", ",_", "record_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parts_", "=_", "record_", "._", "name_", "._", "split_", "(_", "\".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "parts_", ")_", "<=_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "display", "\\u", "name_", "=_", "record_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "For", " ", "example", ",", " ", "\"", "a", ".", "b", ".", "c", ".", "d", "\"", " ", "bec", "ome", "s", " ", "\"", "a", ".", "b", "...", "d", "\".", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "display", "\\u", "name_", "=_", "'.'_", "._", "join_", "(_", "parts_", "[_", ":_", "2_", "]_", "+_", "[_", "'.'_", ",_", "parts_", "[_", "-_", "1_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "record_", "._", "display", "\\u", "name_", "=_", "display", "\\u", "name_", "\\u\\u\\uNEWLINE\\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_", "def_", "get", "\\u", "filter_", "(_", "level_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "level_", "<=_", "logging_", "._", "DEBUG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "=_", "Display", "Name", "Filter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "=_", "Truncate", "d", "Display", "Name", "Filter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "cls_", "(_", ")_", "\\u\\u\\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_", "make", "\\u", "formatter_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pref", "ix", " ", "log", " ", "message", "s", " ", "uno", "bt", "rus", "ively", " ", "with", " ", "\"", "log", "\"", " ", "to", " ", "distinguish", " ", "log_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "message", "s", " ", "more", " ", "ob", "vio", "usl", "y", " ", "from", " ", "other", " ", "text", " ", "sent", " ", "to", " ", "the", " ", "error", " ", "stream", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "format\\u", "string_", "=_", "(_", "\"%", "(", "bg", "\\u", "black", ")", "s", "%", "(", "log", "\\u", "color", ")", "slo", "g", ":", " ", "%", "(", "display", "\\u", "name", ")", "s", ":", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "%", "(", "level", "name", ")", "s", "]%", "(", "reset", ")", "s", " ", "%", "(", "message", ")", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "colors_", "=_", "color", "log_", "._", "default", "\\u", "log", "\\u", "colors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "colors_", "[_", "'", "DEBU", "G", "'_", "]_", "=_", "'", "white", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "formatter_", "=_", "color", "log_", "._", "Color", "ed", "Formatter_", "(_", "format\\u", "string_", ",_", "log", "\\u", "colors_", "=_", "colors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "formatter_", "\\u\\u\\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_", "make", "\\u", "log", "\\u", "handler_", "(_", "level_", ",_", "file\\u_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "file\\u_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file\\u_", "=_", "sys_", "._", "stderr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "file", "\\u", " ", "is", " ", "Non", "e", ",", " ", "Stream", "Handle", "r", " ", "use", "s", " ", "sys", ".", "std", "err", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "handler_", "=_", "logging_", "._", "Stream", "Handler_", "(_", "file\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "can", " ", "we", " ", "delete", " ", "this", " ", "code", " ", "comment", "?", " ", " ", "Is", " ", "there", " ", "any", " ", "reason_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "set", " ", "this", " ", "handler", " ", "to", " ", "a", " ", "level", " ", "different", " ", "from", " ", "the", " ", "root", " ", "logg", "er", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "handler", ".", "set", "Leve", "l", "(", "level", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "filter\\u_", "=_", "get", "\\u", "filter_", "(_", "level_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "add", "Filter_", "(_", "filter\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "formatter_", "=_", "make", "\\u", "formatter_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "set", "Formatter_", "(_", "formatter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "contextmanager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "log", "\\u", "config_", "(_", "level_", ",_", "file\\u_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "context", " ", "manage", "r", " ", "to", " ", "configur", "e", " ", "logg", "ing", " ", "and", " ", "then", " ", "undo", " ", "the", " ", "configura", "tion", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Und", "oin", "g", " ", "the", " ", "configura", "tion", " ", "is", " ", "usef", "ul", " ", "for", " ", "testi", "ng", ",", " ", "sinc", "e", " ", "other", "wis", "e", "\\", "10", ";", " ", " ", " ", " ", "many", " ", "log", " ", "handler", "s", " ", "mig", "ht", " ", "accumulate", " ", "dur", "ing", " ", "the", " ", "course", " ", "of", " ", "testi", "ng", ",", "\\", "10", ";", " ", " ", " ", " ", "due", " ", "to", " ", "success", "ive", " ", "calls", " ", "to", " ", "this", " ", "method", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "ument", "s", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", "level", ":", " ", "lowe", "st", " ", "logg", "ing", " ", "level", " ", "to", " ", "log", ".", "\\", "10", ";", " ", " ", "file", "\\u", ":", " ", "the", " ", "file", " ", "object", " ", "to", " ", "use", " ", "for", " ", "logg", "ing", " ", "(", "e", ".", "g", ".", " ", "sys", ".", "std", "err", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "level_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "level_", "=_", "LOG", "\\u", "LE", "VEL", "\\u", "DEFAULT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "root_", "=_", "logging_", "._", "get", "Logger_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "logg", "ing", " ", "was", " ", "alr", "ead", "y", " ", "configur", "ed", " ", "(", "e", ".", "g", ".", " ", "at", " ", "the", " ", "outs", "et", " ", "of", " ", "a", " ", "test", " ", "run", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "then", " ", "let", "'", "s", " ", "not", " ", "change", " ", "the", " ", "root", " ", "logg", "ing", " ", "level", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "simplify", " ", "this", " ", "logic", " ", "(", "e", ".", "g", ".", " ", "we", " ", "shou", "ld", " ", "not", " ", "need", " ", "\"", "if", "\"", " ", "logic", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "alr", "ead", "y", "\\u", "configured_", "=_", "root_", "._", "has", "Handlers_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "=_", "make", "\\u", "log", "\\u", "handler_", "(_", "level_", ",_", "file\\u_", "=_", "file\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "._", "add", "Handler_", "(_", "handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "alr", "ead", "y", "\\u", "configured_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "root_", "._", "set", "Level_", "(_", "level_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "debug_", "(_", "\"", "root", " ", "logg", "er", " ", "level", " ", "set", " ", "to", ":", " ", "%", "r", "\"_", "%_", "logging_", "._", "get", "Leve", "l", "Name_", "(_", "level_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "log_", "._", "debug_", "(_", "\"", "a", " ", "logg", "ing", " ", "handler", " ", "was", " ", "adde", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "._", "remove", "Handler_", "(_", "handler_", ")_", "\\u\\u\\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_", "make", "\\u", "usage", "\\u", "error_", "(_", "msg_", ",_", "help", "\\u", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "=_", "dedent_", "(_", "\"\"\"", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "Command", "-", "line", " ", "usage", " ", "error", ":", " ", "{", "!", "s", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Pass", " ", "{", "!", "s", "}", " ", "for", " ", "help", " ", "documentation", " ", "and", " ", "avail", "able", " ", "options", ".\"\"\"_", ")_", "._", "format_", "(_", "msg_", ",_", "help", "\\u", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "print", "\\u", "usage", "\\u", "error_", "(_", "parser_", ",_", "msg_", ",_", "file\\u_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "file\\u_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file\\u_", "=_", "sys_", "._", "stderr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "sys_", "._", "argv_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parser_", "._", "print", "\\u", "help_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "parser_", "._", "print", "\\u", "usage_", "(_", "file\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "make", "\\u", "usage", "\\u", "error_", "(_", "msg_", ",_", "parser_", "._", "option", "\\u", "help_", "._", "display_", "(_", "'", " ", "or", " ", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "error_", "(_", "text_", ")_", "\\u\\u\\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_", "non", "\\u", "exit", "ing", "\\u", "main_", "(_", "parser_", ",_", "argv_", ",_", "stdout_", "=_", "None_", ",_", "log", "\\u", "file_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Run", " ", "the", " ", "program", ",", " ", "and", " ", "return", " ", "the", " ", "exit", " ", "status", " ", "with", "out", " ", "exit", "ing", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "ument", "s", ":", "\\", "10", ";", " ", " ", "parser", ":", " ", "an", " ", "argp", "arse", ".", "Arg", "ument", "Parser", " ", "object", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "argv_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log", "\\u", "level_", "=_", "parser_", "._", "safe", "\\u", "get", "\\u", "log", "\\u", "level_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "stdout_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stdout_", "=_", "sys_", "._", "stdout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "log", "\\u", "config_", "(_", "level_", "=_", "log", "\\u", "level_", ",_", "file\\u_", "=_", "log", "\\u", "file_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "debug_", "(_", "\"", "argv", ":", " ", "%", "r", "\"_", "%_", "argv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ns_", "=_", "parser_", "._", "parse", "\\u", "args_", "(_", "args_", "=_", "args_", ")_", "#", " ", "Names", "pace", " ", "object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "debug_", "(_", "\"", "ns", ":", " ", "%", "r", "\"_", "%_", "ns_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Make", " ", "no", " ", "args", " ", "default", " ", "to", " ", "runn", "ing", " ", "help", "._", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "There", " ", "see", "ms", " ", "to", " ", "be", " ", "a", " ", "bug", " ", "in", " ", "argp", "arse", " ", "where", " ", "the", " ", "parent_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "parser", "'", "s", " ", "default", " ", "run", "\\u", "command", " ", "is", " ", "used", " ", "for", " ", "args", " ", "like_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"", "rcv", " ", "rand", "contest", "\"", " ", "(", "whe", "n", " ", "not", "hing", " ", "is", " ", "after", " ", "rand", "contest", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "whe", "n", " ", "parser", ".", "set\\u", "default", "s", "(", "run", "\\u", "command", "=.", "..", ")", " ", "is", " ", "used", " ", "to", " ", "set_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "default", " ", "on", " ", "the", " ", "parent", " ", "parser", ".", " ", " ", "Thu", "s", " ", "we", " ", "use", " ", "try", "-", "except_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "here", " ", "inst", "ead", ".", " ", " ", "I", " ", "beli", "eve", " ", "this", " ", "is", " ", "the", " ", "issue", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "bug", "s", ".", "python", ".", "org", "/", "issue", "935", "1_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "command_", "=_", "ns_", "._", "run", "\\u", "command_", "\\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_", "Help", "Requeste", "d_", "(_", "parser_", "=_", "parser_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "output_", "=_", "command_", "(_", "ns_", ",_", "stdout_", "=_", "stdout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "output_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stdout_", "._", "write_", "(_", "output_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "status_", "=_", "EXIT", "\\u", "STATUS", "\\u", "SUCCESS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Help", "Requeste", "d_", "as_", "exc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parser_", "=_", "exc_", "._", "parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "print", "\\u", "help_", "(_", "file_", "=_", "stdout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "=_", "EXIT", "\\u", "STATUS", "\\u", "SUCCESS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Us", "age", "Exception_", "as_", "exc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "As", " ", "of", " ", "Pyth", "on", " ", "3.4", ",", " ", "argp", "arse", ".", "Arg", "ument", "Parser", "'", "s", " ", "error", "()", " ", "implementation_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "looke", "d", " ", "like", " ", "this", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "self", ".", "print", "\\u", "usage", "(\\u", "sys", ".", "std", "err", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "args", " ", "=", " ", "{", "'", "prog", "':", " ", "self", ".", "prog", ",", " ", "'", "message", "':", " ", "message", "}_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "self", ".", "exit", "(", "2", ",", " ", "\\u(", "'%", "(", "prog", ")", "s", ":", " ", "error", ":", " ", "%", "(", "message", ")", "s", "\\\\", "n", "')", " ", "%", " ", "args", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err", "\\u", "args_", ",_", "parser_", "=_", "exc_", "._", "args_", ",_", "exc_", "._", "parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "err", "\\u", "args_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "\\u", "usage", "\\u", "error_", "(_", "parser_", ",_", "err", "\\u", "args_", "[_", "0_", "]_", ",_", "file\\u_", "=_", "log", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "=_", "EXIT", "\\u", "STATUS", "\\u", "USAGE", "\\u", "ERROR_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "decide", " ", "whe", "ther", " ", "to", " ", "handle", " ", "the", " ", "error", " ", "case", " ", "manu", "ally", ",", " ", "or", " ", "let_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pyth", "on", " ", "do", " ", "it", " ", "by", " ", "default", ".", " ", " ", "One", " ", "problem", " ", "with", " ", "the", " ", "former", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "tha", "t", " ", "exception", "s", " ", "don", "'", "t", " ", "show", " ", "up", " ", "dur", "ing", " ", "test", " ", "fail", "ure", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "except", " ", "Except", "ion", " ", "as", " ", "err", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "#", " ", "Log", " ", "the", " ", "full", " ", "exception", " ", "info", " ", "for", " ", "\"", "unexpected", "\"", " ", "exception", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "log", ".", "error", "(", "format\\u", "exc", "())", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "status", " ", "=", " ", "EXIT", "\\u", "STATUS", "\\u", "FAIL_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "status_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "main_", "(_", "parser_", ",_", "argv_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "argv_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "argv_", "=_", "sys_", "._", "argv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "status_", "=_", "non", "\\u", "exit", "ing", "\\u", "main_", "(_", "parser_", ",_", "argv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "status_", ")_" ]
[ 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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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
deanhiller/databus/webapp/play1.3.x/framework/pym/play/commands/war.py
[ { "content": "import sys\nimport os\nimport getopt\nimport shutil\n\nimport play.commands.precompile\nfrom play.utils import *\n\nCOMMANDS = [\"war\"]\n\nHELP = {\n 'war': 'Export the application as a standalone WAR archive'\n}\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def execute(**kargs):\n\n command = kargs.get(\"command\")\n app = kargs.get(\"app\")\n args = kargs.get(\"args\")\n env = kargs.get(\"env\")\n\n war_path = None\n war_zip_path = None\n war_exclusion_list = []\n try:\n optlist, args = getopt.getopt(args, 'o:', ['output=', 'zip','exclude='])\n for o, a in optlist:\n if o in ('-o', '--output'):\n war_path = os.path.normpath(os.path.abspath(a))\n for o, a in optlist:\n if o in ('--zip'):\n war_zip_path = war_path + '.war'\n if o in ('--exclude'):\n war_exclusion_list = a.split(':')\n print \"~ Excluding these directories :\"\n for excluded in war_exclusion_list:\n print \"~ %s\" %excluded\n except getopt.GetoptError, err:\n print \"~ %s\" % str(err)\n print \"~ Please specify a path where to generate the WAR, using the -o or --output option.\"\n print \"~ To exclude some directories, use the --exclude option and ':'-separator (eg: --exclude .svn:target:logs:tmp).\"\n print \"~ \"\n sys.exit(-1)\n\n if not war_path:\n print \"~ Oops. Please specify a path where to generate the WAR, using the -o or --output option\"\n print \"~ To exclude some directories, use the --exclude option and ':'-separator (eg: --exclude .svn:target:logs:tmp).\"\n print \"~\"\n sys.exit(-1)\n\n if os.path.exists(war_path) and not os.path.exists(os.path.join(war_path, 'WEB-INF')):\n print \"~ Oops. The destination path already exists but does not seem to host a valid WAR structure\"\n print \"~\"\n sys.exit(-1)\n\n if isParentOf(app.path, war_path) and not isExcluded(war_path, war_exclusion_list):\n print \"~ Oops. Please specify a destination directory outside of the application\"\n print \"~ or exclude war destination directory using the --exclude option and ':'-separator \"\n print \"~ (eg: --exclude .svn:target:logs:tmp).\"\n print \"~\"\n sys.exit(-1)\n\n # Precompile first\n precompilation_result = play.commands.precompile.execute(command=command, app=app, args=args, env=env)\n\n if precompilation_result != 0:\n print \"~ Please fix compilation errors before packaging WAR\"\n print \"~\"\n sys.exit(precompilation_result)\n\n # Package\n package_as_war(app, env, war_path, war_zip_path, war_exclusion_list)\n\n print \"~ Done !\"\n print \"~\"\n print \"~ You can now load %s as a standard WAR into your servlet container\" % (os.path.normpath(war_path))\n print \"~ You can't use play standard commands to run/stop/debug the WAR application...\"\n print \"~ ... just use your servlet container commands instead\"\n print \"~\"\n print \"~ Have fun!\"\n print \"~\"", "metadata": "root.execute", "header": "['module', '___EOS___']", "index": 14 } ]
[ { "span": "import shutil", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 13 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "getopt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "play_", "._", "commands_", "._", "precom", "pile", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "play_", "._", "utils_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "COMMANDS_", "=_", "[_", "\"", "war", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "HELP_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "war", "'_", ":_", "'", "Export", " ", "the", " ", "applica", "tion", " ", "as", " ", "a", " ", "standalone", " ", "WAR", " ", "archive", "'_", "\\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_", "execute_", "(_", "**_", "kargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "command_", "=_", "kargs_", "._", "get_", "(_", "\"", "command", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "=_", "kargs_", "._", "get_", "(_", "\"", "app", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "kargs_", "._", "get_", "(_", "\"", "args", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "=_", "kargs_", "._", "get_", "(_", "\"", "env", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "war", "\\u", "path_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "war", "\\u", "zip", "\\u", "path_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "war", "\\u", "exclusion", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opt", "list_", ",_", "args_", "=_", "getopt_", "._", "getopt_", "(_", "args_", ",_", "'", "o", ":'_", ",_", "[_", "'", "output", "='_", ",_", "'", "zip", "'_", ",_", "'", "exclu", "de", "='_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "o_", ",_", "a_", "in_", "opt", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "o_", "in_", "(_", "'-", "o", "'_", ",_", "'--", "output", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "war", "\\u", "path_", "=_", "os_", "._", "path_", "._", "normpath_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "a_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "o_", ",_", "a_", "in_", "opt", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "o_", "in_", "(_", "'--", "zip", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "war", "\\u", "zip", "\\u", "path_", "=_", "war", "\\u", "path_", "+_", "'.", "war", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "o_", "in_", "(_", "'--", "exclu", "de", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "war", "\\u", "exclusion", "\\u", "list_", "=_", "a_", "._", "split_", "(_", "':'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "~", " ", "Exclu", "ding", " ", "these", " ", "director", "ies", " ", ":\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "excluded_", "in_", "war", "\\u", "exclusion", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "\"", "~", " ", " ", "%", "s", "\"_", "%_", "excluded_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "getopt_", "._", "Get", "opt", "Error_", ",_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "~", " ", "%", "s", "\"_", "%_", "str_", "(_", "err_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "~", " ", "Ple", "ase", " ", "speci", "fy", " ", "a", " ", "path", " ", "where", " ", "to", " ", "generat", "e", " ", "the", " ", "WAR", ",", " ", "usi", "ng", " ", "the", " ", "-", "o", " ", "or", " ", "--", "output", " ", "option", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "~", " ", "To", " ", "exclu", "de", " ", "some", " ", "director", "ies", ",", " ", "use", " ", "the", " ", "--", "exclu", "de", " ", "option", " ", "and", " ", "':", "'-", "separator", " ", "(", "eg", ":", " ", "--", "exclu", "de", " ", ".", "svn", ":", "target", ":", "logs", ":", "tmp", ").\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "~", " ", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "war", "\\u", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "~", " ", "Oo", "ps", ".", " ", "Ple", "ase", " ", "speci", "fy", " ", "a", " ", "path", " ", "where", " ", "to", " ", "generat", "e", " ", "the", " ", "WAR", ",", " ", "usi", "ng", " ", "the", " ", "-", "o", " ", "or", " ", "--", "output", " ", "option", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "~", " ", "To", " ", "exclu", "de", " ", "some", " ", "director", "ies", ",", " ", "use", " ", "the", " ", "--", "exclu", "de", " ", "option", " ", "and", " ", "':", "'-", "separator", " ", "(", "eg", ":", " ", "--", "exclu", "de", " ", ".", "svn", ":", "target", ":", "logs", ":", "tmp", ").\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"~\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "war", "\\u", "path_", ")_", "and_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "os_", "._", "path_", "._", "join_", "(_", "war", "\\u", "path_", ",_", "'", "WEB", "-", "INF", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "~", " ", "Oo", "ps", ".", " ", "The", " ", "destinat", "ion", " ", "path", " ", "alr", "ead", "y", " ", "exist", "s", " ", "but", " ", "doe", "s", " ", "not", " ", "see", "m", " ", "to", " ", "host", " ", "a", " ", "valid", " ", "WAR", " ", "structure", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"~\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "Parent", "Of_", "(_", "app_", "._", "path_", ",_", "war", "\\u", "path_", ")_", "and_", "not_", "is", "Exclude", "d_", "(_", "war", "\\u", "path_", ",_", "war", "\\u", "exclusion", "\\u", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "~", " ", "Oo", "ps", ".", " ", "Ple", "ase", " ", "speci", "fy", " ", "a", " ", "destinat", "ion", " ", "director", "y", " ", "outsi", "de", " ", "of", " ", "the", " ", "applica", "tion", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "~", " ", "or", " ", "exclu", "de", " ", "war", " ", "destinat", "ion", " ", "director", "y", " ", "usi", "ng", " ", "the", " ", "--", "exclu", "de", " ", "option", " ", "and", " ", "':", "'-", "separator", " ", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "~", " ", "(", "eg", ":", " ", "--", "exclu", "de", " ", ".", "svn", ":", "target", ":", "logs", ":", "tmp", ").\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"~\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Prec", "omp", "ile", " ", "first_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "precom", "pila", "tion", "\\u", "result_", "=_", "play_", "._", "commands_", "._", "precom", "pile", "_", "._", "execute_", "(_", "command_", "=_", "command_", ",_", "app_", "=_", "app_", ",_", "args_", "=_", "args_", ",_", "env_", "=_", "env_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "precom", "pila", "tion", "\\u", "result_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "~", " ", "Ple", "ase", " ", "fix", " ", "compilation", " ", "error", "s", " ", "bef", "ore", " ", "packaging", " ", "WAR", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"~\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "precom", "pila", "tion", "\\u", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Package_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "package", "\\u", "as", "\\u", "war", "_", "(_", "app_", ",_", "env_", ",_", "war", "\\u", "path_", ",_", "war", "\\u", "zip", "\\u", "path_", ",_", "war", "\\u", "exclusion", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"", "~", " ", "Don", "e", " ", "!\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"~\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "~", " ", "You", " ", "can", " ", "now", " ", "load", " ", "%", "s", " ", "as", " ", "a", " ", "standard", " ", "WAR", " ", "int", "o", " ", "your", " ", "serv", "let", " ", "container", "\"_", "%_", "(_", "os_", "._", "path_", "._", "normpath_", "(_", "war", "\\u", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "~", " ", "You", " ", "can", "'", "t", " ", "use", " ", "play", " ", "standard", " ", "command", "s", " ", "to", " ", "run", "/", "stop", "/", "debug", " ", "the", " ", "WAR", " ", "applica", "tion", "...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "~", " ", "...", " ", "just", " ", "use", " ", "your", " ", "serv", "let", " ", "container", " ", "command", "s", " ", "inst", "ead", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"~\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "~", " ", "Ha", "ve", " ", "fun", "!\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"~\"_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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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
coreemu/core/daemon/core/emane/nodes.py
[ { "content": "#\n# CORE\n# Copyright (c)2010-2014 the Boeing Company.\n# See the LICENSE file included in this distribution.\n#\n# author: Jeff Ahrenholz <[email protected]>\n#\n'''\nnodes.py: definition of an EmaneNode class for implementing configuration\ncontrol of an EMANE emulation. An EmaneNode has several attached NEMs that\nshare the same MAC+PHY model.\n'''\n\nimport sys\nimport os.path\n\nfrom core.api import coreapi\nfrom core.coreobj import PyCoreNet\ntry:\n from emanesh.events import EventService\n from emanesh.events import LocationEvent\nexcept Exception, e:\n pass\n\ntry:\n import emaneeventservice\n import emaneeventlocation\nexcept Exception, e:\n ''' Don't require all CORE users to have EMANE libeventservice and its\n Python bindings installed.\n '''\n pass\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class EmaneNet(PyCoreNet):\n ''' EMANE network base class.\n '''\n apitype = coreapi.CORE_NODE_EMANE\n linktype = coreapi.CORE_LINK_WIRELESS\n type = \"wlan\" # icon used", "metadata": "root.EmaneNet", "header": "['module', '___EOS___']", "index": 33 }, { "content": "class EmaneNode(EmaneNet):\n ''' EMANE node contains NEM configuration and causes connected nodes\n to have TAP interfaces (instead of VEth). These are managed by the\n Emane controller object that exists in a session.\n '''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.EmaneNode", "header": "['module', '___EOS___']", "index": 40 }, { "content": " def __init__(self, session, objid = None, name = None, verbose = False,\n start = True):\n PyCoreNet.__init__(self, session, objid, name, verbose, start)\n self.verbose = verbose\n self.conf = \"\"\n self.up = False\n self.nemidmap = {}\n self.model = None\n self.mobility = None", "metadata": "root.EmaneNode.__init__", "header": "['class', 'EmaneNode', '(', 'EmaneNet', ')', ':', '___EOS___']", "index": 45 }, { "content": " def linkconfig(self, netif, bw = None, delay = None,\n loss = None, duplicate = None, jitter = None, netif2 = None):\n ''' The CommEffect model supports link configuration.\n '''\n if not self.model:\n return\n return self.model.linkconfig(netif=netif, bw=bw, delay=delay, loss=loss,\n duplicate=duplicate, jitter=jitter, netif2=netif2)", "metadata": "root.EmaneNode.linkconfig", "header": "['class', 'EmaneNode', '(', 'EmaneNet', ')', ':', '___EOS___']", "index": 55 }, { "content": " def config(self, conf):\n #print \"emane\", self.name, \"got config:\", conf\n self.conf = conf", "metadata": "root.EmaneNode.config", "header": "['class', 'EmaneNode', '(', 'EmaneNet', ')', ':', '___EOS___']", "index": 64 }, { "content": " def shutdown(self):\n pass", "metadata": "root.EmaneNode.shutdown", "header": "['class', 'EmaneNode', '(', 'EmaneNet', ')', ':', '___EOS___']", "index": 68 }, { "content": " def link(self, netif1, netif2):\n pass", "metadata": "root.EmaneNode.link", "header": "['class', 'EmaneNode', '(', 'EmaneNet', ')', ':', '___EOS___']", "index": 71 }, { "content": " def unlink(self, netif1, netif2):\n pass", "metadata": "root.EmaneNode.unlink", "header": "['class', 'EmaneNode', '(', 'EmaneNet', ')', ':', '___EOS___']", "index": 74 }, { "content": " def setmodel(self, model, config):\n ''' set the EmaneModel associated with this node\n '''\n if (self.verbose):\n self.info(\"adding model %s\" % model._name)\n if model._type == coreapi.CORE_TLV_REG_WIRELESS:\n # EmaneModel really uses values from ConfigurableManager\n # when buildnemxml() is called, not during init()\n self.model = model(session=self.session, objid=self.objid,\n verbose=self.verbose)\n elif model._type == coreapi.CORE_TLV_REG_MOBILITY:\n self.mobility = model(session=self.session, objid=self.objid,\n verbose=self.verbose, values=config)", "metadata": "root.EmaneNode.setmodel", "header": "['class', 'EmaneNode', '(', 'EmaneNet', ')', ':', '___EOS___']", "index": 77 }, { "content": " def setnemid(self, netif, nemid):\n ''' Record an interface to numerical ID mapping. The Emane controller\n object manages and assigns these IDs for all NEMs.\n '''\n self.nemidmap[netif] = nemid", "metadata": "root.EmaneNode.setnemid", "header": "['class', 'EmaneNode', '(', 'EmaneNet', ')', ':', '___EOS___']", "index": 91 }, { "content": " def getnemid(self, netif):\n ''' Given an interface, return its numerical ID.\n '''\n if netif not in self.nemidmap:\n return None\n else:\n return self.nemidmap[netif]", "metadata": "root.EmaneNode.getnemid", "header": "['class', 'EmaneNode', '(', 'EmaneNet', ')', ':', '___EOS___']", "index": 97 }, { "content": " def getnemnetif(self, nemid):\n ''' Given a numerical NEM ID, return its interface. This returns the\n first interface that matches the given NEM ID.\n '''\n for netif in self.nemidmap:\n if self.nemidmap[netif] == nemid:\n return netif\n return None", "metadata": "root.EmaneNode.getnemnetif", "header": "['class', 'EmaneNode', '(', 'EmaneNet', ')', ':', '___EOS___']", "index": 105 }, { "content": " def netifs(self, sort=True):\n ''' Retrieve list of linked interfaces sorted by node number.\n '''\n return sorted(self._netif.values(), key=lambda ifc: ifc.node.objid)", "metadata": "root.EmaneNode.netifs", "header": "['class', 'EmaneNode', '(', 'EmaneNet', ')', ':', '___EOS___']", "index": 114 }, { "content": " def buildplatformxmlentry(self, doc):\n ''' Return a dictionary of XML elements describing the NEMs\n connected to this EmaneNode for inclusion in the platform.xml file.\n '''\n ret = {}\n if self.model is None:\n self.info(\"warning: EmaneNode %s has no associated model\" % \\\n self.name)\n return ret\n for netif in self.netifs():\n # <nem name=\"NODE-001\" definition=\"rfpipenem.xml\">\n nementry = self.model.buildplatformxmlnementry(doc, self, netif)\n # <transport definition=\"transvirtual.xml\" group=\"1\">\n # <param name=\"device\" value=\"n1.0.158\" />\n # </transport>\n trans = self.model.buildplatformxmltransportentry(doc, self, netif)\n nementry.appendChild(trans)\n ret[netif] = nementry\n\n return ret", "metadata": "root.EmaneNode.buildplatformxmlentry", "header": "['class', 'EmaneNode', '(', 'EmaneNet', ')', ':', '___EOS___']", "index": 119 }, { "content": " def buildnemxmlfiles(self, emane):\n ''' Let the configured model build the necessary nem, mac, and phy\n XMLs.\n '''\n if self.model is None:\n return\n # build XML for overall network (EmaneNode) configs\n self.model.buildnemxmlfiles(emane, ifc=None)\n # build XML for specific interface (NEM) configs\n need_virtual = False\n need_raw = False\n vtype = \"virtual\"\n rtype = \"raw\"\n for netif in self.netifs():\n self.model.buildnemxmlfiles(emane, netif)\n if \"virtual\" in netif.transport_type:\n need_virtual = True\n vtype = netif.transport_type\n else:\n need_raw = True\n rtype = netif.transport_type\n # build transport XML files depending on type of interfaces involved\n if need_virtual:\n self.buildtransportxml(emane, vtype)\n if need_raw:\n self.buildtransportxml(emane, rtype)", "metadata": "root.EmaneNode.buildnemxmlfiles", "header": "['class', 'EmaneNode', '(', 'EmaneNet', ')', ':', '___EOS___']", "index": 140 }, { "content": " def buildtransportxml(self, emane, type):\n ''' Write a transport XML file for the Virtual or Raw Transport.\n '''\n transdoc = emane.xmldoc(\"transport\")\n trans = transdoc.getElementsByTagName(\"transport\").pop()\n trans.setAttribute(\"name\", \"%s Transport\" % type.capitalize())\n trans.setAttribute(\"library\", \"trans%s\" % type.lower())\n trans.appendChild(emane.xmlparam(transdoc, \"bitrate\", \"0\"))\n\n flowcontrol = False\n names = self.model.getnames()\n values = emane.getconfig(self.objid, self.model._name,\n self.model.getdefaultvalues())[1]\n if \"flowcontrolenable\" in names and values:\n i = names.index(\"flowcontrolenable\")\n if self.model.booltooffon(values[i]) == \"on\":\n flowcontrol = True\n\n if \"virtual\" in type.lower():\n if os.path.exists(\"/dev/net/tun_flowctl\"):\n trans.appendChild(emane.xmlparam(transdoc, \"devicepath\",\n \"/dev/net/tun_flowctl\"))\n else:\n trans.appendChild(emane.xmlparam(transdoc, \"devicepath\",\n \"/dev/net/tun\"))\n if flowcontrol:\n trans.appendChild(emane.xmlparam(transdoc, \"flowcontrolenable\",\n \"on\"))\n emane.xmlwrite(transdoc, self.transportxmlname(type.lower()))", "metadata": "root.EmaneNode.buildtransportxml", "header": "['class', 'EmaneNode', '(', 'EmaneNet', ')', ':', '___EOS___']", "index": 167 }, { "content": " def transportxmlname(self, type):\n ''' Return the string name for the Transport XML file,\n e.g. 'n3transvirtual.xml'\n '''\n return \"n%strans%s.xml\" % (self.objid, type)", "metadata": "root.EmaneNode.transportxmlname", "header": "['class', 'EmaneNode', '(', 'EmaneNet', ')', ':', '___EOS___']", "index": 197 }, { "content": " def installnetifs(self, do_netns=True):\n ''' Install TAP devices into their namespaces. This is done after\n EMANE daemons have been started, because that is their only chance\n to bind to the TAPs.\n '''\n if self.session.emane.genlocationevents() and \\\n self.session.emane.service is None:\n warntxt = \"unable to publish EMANE events because the eventservice \"\n warntxt += \"Python bindings failed to load\"\n self.session.exception(coreapi.CORE_EXCP_LEVEL_ERROR, self.name,\n self.objid, warntxt)\n\n for netif in self.netifs():\n if do_netns and \"virtual\" in netif.transport_type.lower():\n netif.install()\n netif.setaddrs()\n if not self.session.emane.genlocationevents():\n netif.poshook = None\n continue\n # at this point we register location handlers for generating\n # EMANE location events\n netif.poshook = self.setnemposition\n (x,y,z) = netif.node.position.get()\n self.setnemposition(netif, x, y, z)", "metadata": "root.EmaneNode.installnetifs", "header": "['class', 'EmaneNode', '(', 'EmaneNet', ')', ':', '___EOS___']", "index": 204 }, { "content": " def deinstallnetifs(self):\n ''' Uninstall TAP devices. This invokes their shutdown method for\n any required cleanup; the device may be actually removed when\n emanetransportd terminates.\n '''\n for netif in self.netifs():\n if \"virtual\" in netif.transport_type.lower():\n netif.shutdown()\n netif.poshook = None", "metadata": "root.EmaneNode.deinstallnetifs", "header": "['class', 'EmaneNode', '(', 'EmaneNet', ')', ':', '___EOS___']", "index": 229 }, { "content": " def setnemposition(self, netif, x, y, z):\n ''' Publish a NEM location change event using the EMANE event service.\n '''\n if self.session.emane.service is None:\n if self.verbose:\n self.info(\"position service not available\")\n return\n nemid = self.getnemid(netif)\n ifname = netif.localname\n if nemid is None:\n self.info(\"nemid for %s is unknown\" % ifname)\n return\n (lat, long, alt) = self.session.location.getgeo(x, y, z)\n if self.verbose:\n self.info(\"setnemposition %s (%s) x,y,z=(%d,%d,%s)\"\n \"(%.6f,%.6f,%.6f)\" % \\\n (ifname, nemid, x, y, z, lat, long, alt))\n if self.session.emane.version >= self.session.emane.EMANE091:\n event = LocationEvent()\n else:\n event = emaneeventlocation.EventLocation(1)\n # altitude must be an integer or warning is printed\n # unused: yaw, pitch, roll, azimuth, elevation, velocity\n alt = int(round(alt))\n if self.session.emane.version >= self.session.emane.EMANE091:\n event.append(nemid, latitude=lat, longitude=long, altitude=alt)\n self.session.emane.service.publish(0, event)\n else:\n event.set(0, nemid, lat, long, alt)\n self.session.emane.service.publish(emaneeventlocation.EVENT_ID,\n emaneeventservice.PLATFORMID_ANY,\n emaneeventservice.NEMID_ANY,\n emaneeventservice.COMPONENTID_ANY,\n event.export())", "metadata": "root.EmaneNode.setnemposition", "header": "['class', 'EmaneNode', '(', 'EmaneNet', ')', ':', '___EOS___']", "index": 239 }, { "content": " def setnempositions(self, moved_netifs):\n ''' Several NEMs have moved, from e.g. a WaypointMobilityModel\n calculation. Generate an EMANE Location Event having several\n entries for each netif that has moved.\n '''\n if len(moved_netifs) == 0:\n return\n if self.session.emane.service is None:\n if self.verbose:\n self.info(\"position service not available\")\n return\n\n if self.session.emane.version >= self.session.emane.EMANE091:\n event = LocationEvent()\n else:\n event = emaneeventlocation.EventLocation(len(moved_netifs))\n i = 0\n for netif in moved_netifs:\n nemid = self.getnemid(netif)\n ifname = netif.localname\n if nemid is None:\n self.info(\"nemid for %s is unknown\" % ifname)\n continue\n (x, y, z) = netif.node.getposition()\n (lat, long, alt) = self.session.location.getgeo(x, y, z)\n if self.verbose:\n self.info(\"setnempositions %d %s (%s) x,y,z=(%d,%d,%s)\"\n \"(%.6f,%.6f,%.6f)\" % \\\n (i, ifname, nemid, x, y, z, lat, long, alt))\n # altitude must be an integer or warning is printed\n alt = int(round(alt))\n if self.session.emane.version >= self.session.emane.EMANE091:\n event.append(nemid, latitude=lat, longitude=long, altitude=alt)\n else:\n event.set(i, nemid, lat, long, alt)\n i += 1\n\n if self.session.emane.version >= self.session.emane.EMANE091:\n self.session.emane.service.publish(0, event)\n else:\n self.session.emane.service.publish(emaneeventlocation.EVENT_ID,\n emaneeventservice.PLATFORMID_ANY,\n emaneeventservice.NEMID_ANY,\n emaneeventservice.COMPONENTID_ANY,\n event.export())", "metadata": "root.EmaneNode.setnempositions", "header": "['class', 'EmaneNode', '(', 'EmaneNet', ')', ':', '___EOS___']", "index": 274 } ]
[ { "span": "import sys", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 10 }, { "span": "from emanesh.events import EventService", "start_line": 19, "start_column": 4, "end_line": 19, "end_column": 43 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "CORE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", "2010", "-", "2014", " ", "the", " ", "Bo", "ein", "g", " ", "Compa", "ny", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "LICENSE", " ", "file", " ", "include", "d", " ", "in", " ", "this", " ", "distribu", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "author", ":", " ", "Je", "ff", " ", "Ah", "ren", "hol", "z", " ", "<", "je", "ff", "rey", ".", "m", ".", "ah", "ren", "hol", "z", "@", "bo", "ein", "g", ".", "com", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", "nodes", ".", "py", ":", " ", "definit", "ion", " ", "of", " ", "an", " ", "Ema", "ne", "Node", " ", "class", " ", "for", " ", "implement", "ing", " ", "configura", "tion", "\\", "10", ";", "control", " ", "of", " ", "an", " ", "EMA", "NE", " ", "emulation", ".", " ", "An", " ", "Ema", "ne", "Node", " ", "has", " ", "sever", "al", " ", "attache", "d", " ", "NE", "Ms", " ", "tha", "t", "\\", "10", ";", "share", " ", "the", " ", "same", " ", "MAC", "+", "PHY", " ", "model", ".", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "core_", "._", "api_", "import_", "core", "api_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core_", "._", "core", "obj_", "import_", "Py", "Core", "Net_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "eman", "esh", "_", "._", "events_", "import_", "Event", "Service_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "eman", "esh", "_", "._", "events_", "import_", "Locat", "ion", "Event_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\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 ", " _", "import_", "eman", "ee", "vent", "service_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "eman", "ee", "vent", "location_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Don", "'", "t", " ", "require", " ", "all", " ", "CORE", " ", "users", " ", "to", " ", "have", " ", "EMA", "NE", " ", "libe", "vent", "service", " ", "and", " ", "its", "\\", "10", ";", " ", " ", " ", " ", "Pyth", "on", " ", "bindi", "ngs", " ", "install", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\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_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Ema", "ne", "Net_", "(_", "Py", "Core", "Net_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "EMA", "NE", " ", "network", " ", "base", " ", "class", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "api", "type_", "=_", "core", "api_", "._", "CORE", "\\u", "NODE", "\\u", "EMA", "NE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "linkt", "ype_", "=_", "core", "api_", "._", "CORE", "\\u", "LINK", "\\u", "WIRE", "LESS", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "type_", "=_", "\"", "wlan", "\"_", "#", " ", "icon", " ", "used_", "\\u\\u\\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_", "Ema", "ne", "Node_", "(_", "Ema", "ne", "Net_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "EMA", "NE", " ", "node", " ", "contain", "s", " ", "NE", "M", " ", "configura", "tion", " ", "and", " ", "caus", "es", " ", "connect", "ed", " ", "nodes", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "have", " ", "TAP", " ", "interface", "s", " ", "(", "inst", "ead", " ", "of", " ", "VE", "th", ").", " ", "The", "se", " ", "are", " ", "manage", "d", " ", "by", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "Ema", "ne", " ", "controlle", "r", " ", "object", " ", "tha", "t", " ", "exist", "s", " ", "in", " ", "a", " ", "session", ".", "\\", "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\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Ema", "ne", "Node_", "(_", "Ema", "ne", "Net_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "session_", ",_", "obji", "d_", "=_", "None_", ",_", "name_", "=_", "None_", ",_", "verbose_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Py", "Core", "Net_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "session_", ",_", "obji", "d_", ",_", "name_", ",_", "verbose_", ",_", "start_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "verbose_", "=_", "verbose_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "conf_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "up_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "nem", "idm", "ap_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "model_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mobi", "lity_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ema", "ne", "Node_", "(_", "Ema", "ne", "Net_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "link", "config_", "(_", "self_", ",_", "neti", "f_", ",_", "bw_", "=_", "None_", ",_", "delay_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "loss_", "=_", "None_", ",_", "duplicate_", "=_", "None_", ",_", "jitter_", "=_", "None_", ",_", "neti", "f2_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "The", " ", "Comm", "Effe", "ct", " ", "model", " ", "support", "s", " ", "link", " ", "configura", "tion", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "model_", ":_", "\\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_", "return_", "self_", "._", "model_", "._", "link", "config_", "(_", "neti", "f_", "=_", "neti", "f_", ",_", "bw_", "=_", "bw_", ",_", "delay_", "=_", "delay_", ",_", "loss_", "=_", "loss_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "duplicate_", "=_", "duplicate_", ",_", "jitter_", "=_", "jitter_", ",_", "neti", "f2_", "=_", "neti", "f2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ema", "ne", "Node_", "(_", "Ema", "ne", "Net_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "config_", "(_", "self_", ",_", "conf_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "\"", "eman", "e", "\",", " ", "self", ".", "name", ",", " ", "\"", "got", " ", "config", ":\"", ",", " ", "conf_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "conf_", "=_", "conf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ema", "ne", "Node_", "(_", "Ema", "ne", "Net_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "shutdown_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ema", "ne", "Node_", "(_", "Ema", "ne", "Net_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "link_", "(_", "self_", ",_", "neti", "f1_", ",_", "neti", "f2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ema", "ne", "Node_", "(_", "Ema", "ne", "Net_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "unlink_", "(_", "self_", ",_", "neti", "f1_", ",_", "neti", "f2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ema", "ne", "Node_", "(_", "Ema", "ne", "Net_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setmo", "del_", "(_", "self_", ",_", "model_", ",_", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "set", " ", "the", " ", "Ema", "ne", "Model", " ", "associate", "d", " ", "with", " ", "this", " ", "node", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "verbose_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "info_", "(_", "\"", "addin", "g", " ", "model", " ", "%", "s", "\"_", "%_", "model_", "._", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "model_", "._", "\\u", "type_", "==_", "core", "api_", "._", "CORE", "\\u", "TLV", "\\u", "REG", "\\u", "WIRE", "LESS", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ema", "ne", "Model", " ", "reall", "y", " ", "use", "s", " ", "values", " ", "from", " ", "Configura", "ble", "Manager_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "whe", "n", " ", "build", "nem", "xml", "()", " ", "is", " ", "call", "ed", ",", " ", "not", " ", "dur", "ing", " ", "init", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "model_", "=_", "model_", "(_", "session_", "=_", "self_", "._", "session_", ",_", "obji", "d_", "=_", "self_", "._", "obji", "d_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "verbose_", "=_", "self_", "._", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "model_", "._", "\\u", "type_", "==_", "core", "api_", "._", "CORE", "\\u", "TLV", "\\u", "REG", "\\u", "MOB", "ILI", "TY_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mobi", "lity_", "=_", "model_", "(_", "session_", "=_", "self_", "._", "session_", ",_", "obji", "d_", "=_", "self_", "._", "obji", "d_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "verbose_", "=_", "self_", "._", "verbose_", ",_", "values_", "=_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ema", "ne", "Node_", "(_", "Ema", "ne", "Net_", ")_", ":_", "\\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_", "setn", "emi", "d_", "(_", "self_", ",_", "neti", "f_", ",_", "nem", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Record", " ", "an", " ", "interface", " ", "to", " ", "numerical", " ", "ID", " ", "mapping", ".", " ", "The", " ", "Ema", "ne", " ", "controlle", "r", "\\", "10", ";", " ", " ", " ", " ", "object", " ", "manage", "s", " ", "and", " ", "assign", "s", " ", "these", " ", "ID", "s", " ", "for", " ", "all", " ", "NE", "Ms", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "nem", "idm", "ap_", "[_", "neti", "f_", "]_", "=_", "nem", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ema", "ne", "Node_", "(_", "Ema", "ne", "Net_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "getne", "mid_", "(_", "self_", ",_", "neti", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Give", "n", " ", "an", " ", "interface", ",", " ", "return", " ", "its", " ", "numerical", " ", "ID", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "neti", "f_", "not_", "in_", "self_", "._", "nem", "idm", "ap_", ":_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "nem", "idm", "ap_", "[_", "neti", "f_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ema", "ne", "Node_", "(_", "Ema", "ne", "Net_", ")_", ":_", "\\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_", "getne", "mne", "tif", "_", "(_", "self_", ",_", "nem", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Give", "n", " ", "a", " ", "numerical", " ", "NE", "M", " ", "ID", ",", " ", "return", " ", "its", " ", "interface", ".", " ", "Thi", "s", " ", "return", "s", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "first", " ", "interface", " ", "tha", "t", " ", "matche", "s", " ", "the", " ", "give", "n", " ", "NE", "M", " ", "ID", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "neti", "f_", "in_", "self_", "._", "nem", "idm", "ap_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "nem", "idm", "ap_", "[_", "neti", "f_", "]_", "==_", "nem", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "neti", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ema", "ne", "Node_", "(_", "Ema", "ne", "Net_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "neti", "fs_", "(_", "self_", ",_", "sort_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Retrieve", " ", "list", " ", "of", " ", "linked", " ", "interface", "s", " ", "sorte", "d", " ", "by", " ", "node", " ", "number", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "sorted_", "(_", "self_", "._", "\\u", "neti", "f_", "._", "values_", "(_", ")_", ",_", "key_", "=_", "lambda_", "ifc", "_", ":_", "ifc", "_", "._", "node_", "._", "obji", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ema", "ne", "Node_", "(_", "Ema", "ne", "Net_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "build", "platform", "xml", "entry_", "(_", "self_", ",_", "doc_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Return", " ", "a", " ", "dictionar", "y", " ", "of", " ", "XML", " ", "element", "s", " ", "descri", "bing", " ", "the", " ", "NE", "Ms", "\\", "10", ";", " ", " ", " ", " ", "connect", "ed", " ", "to", " ", "this", " ", "Ema", "ne", "Node", " ", "for", " ", "inclusion", " ", "in", " ", "the", " ", "platform", ".", "xml", " ", "file", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "model_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "info_", "(_", "\"", "warn", "ing", ":", " ", "Ema", "ne", "Node", " ", "%", "s", " ", "has", " ", "no", " ", "associate", "d", " ", "model", "\"_", "%_", "self_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "neti", "f_", "in_", "self_", "._", "neti", "fs_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "<", "nem", " ", "name", "=\"", "NODE", "-0", "01", "\"", " ", "definit", "ion", "=\"", "rf", "pipe", "nem", ".", "xml", "\">", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nem", "entry_", "=_", "self_", "._", "model_", "._", "build", "platform", "xml", "nem", "entry_", "(_", "doc_", ",_", "self_", ",_", "neti", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "<", "transport", " ", "definit", "ion", "=\"", "trans", "virtual", ".", "xml", "\"", " ", "group", "=\"", "1", "\">", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "<", "param", " ", "name", "=\"", "device", "\"", " ", "value", "=\"", "n1", ".0", ".1", "5", "8", "\"", " ", "/>", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "</", "transport", ">_", "\\u\\u\\uNL\\u\\u\\u_", "trans_", "=_", "self_", "._", "model_", "._", "build", "platform", "xmlt", "rans", "porte", "ntry_", "(_", "doc_", ",_", "self_", ",_", "neti", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nem", "entry_", "._", "append", "Child_", "(_", "trans_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "[_", "neti", "f_", "]_", "=_", "nem", "entry_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ema", "ne", "Node_", "(_", "Ema", "ne", "Net_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "build", "nem", "xmlfile", "s_", "(_", "self_", ",_", "eman", "e_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Let", " ", "the", " ", "configur", "ed", " ", "model", " ", "build", " ", "the", " ", "necessar", "y", " ", "nem", ",", " ", "mac", ",", " ", "and", " ", "phy", "\\", "10", ";", " ", " ", " ", " ", "XML", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "model_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "build", " ", "XML", " ", "for", " ", "over", "all", " ", "network", " ", "(", "Ema", "ne", "Node", ")", " ", "configs_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "model_", "._", "build", "nem", "xmlfile", "s_", "(_", "eman", "e_", ",_", "ifc", "_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "build", " ", "XML", " ", "for", " ", "specific", " ", "interface", " ", "(", "NE", "M", ")", " ", "configs_", "\\u\\u\\uNL\\u\\u\\u_", "need", "\\u", "virtual_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "need", "\\u", "raw_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vtype_", "=_", "\"", "virtual", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rtype_", "=_", "\"", "raw", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "neti", "f_", "in_", "self_", "._", "neti", "fs_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "model_", "._", "build", "nem", "xmlfile", "s_", "(_", "eman", "e_", ",_", "neti", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\"", "virtual", "\"_", "in_", "neti", "f_", "._", "transport", "\\u", "type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "need", "\\u", "virtual_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vtype_", "=_", "neti", "f_", "._", "transport", "\\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 ", " _", "need", "\\u", "raw_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rtype_", "=_", "neti", "f_", "._", "transport", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "build", " ", "transport", " ", "XML", " ", "files", " ", "depend", "ing", " ", "on", " ", "type", " ", "of", " ", "interface", "s", " ", "involved", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "need", "\\u", "virtual_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "build", "transport", "xml_", "(_", "eman", "e_", ",_", "vtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "need", "\\u", "raw_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "build", "transport", "xml_", "(_", "eman", "e_", ",_", "rtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ema", "ne", "Node_", "(_", "Ema", "ne", "Net_", ")_", ":_", "\\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_", "build", "transport", "xml_", "(_", "self_", ",_", "eman", "e_", ",_", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Write", " ", "a", " ", "transport", " ", "XML", " ", "file", " ", "for", " ", "the", " ", "Virt", "ual", " ", "or", " ", "Ra", "w", " ", "Transp", "ort", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trans", "doc_", "=_", "eman", "e_", "._", "xmld", "oc_", "(_", "\"", "transport", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trans_", "=_", "trans", "doc_", "._", "get", "Element", "s", "By", "Ta", "g", "Name_", "(_", "\"", "transport", "\"_", ")_", "._", "pop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trans_", "._", "set", "Attribute_", "(_", "\"", "name", "\"_", ",_", "\"%", "s", " ", "Transp", "ort", "\"_", "%_", "type_", "._", "capitalize_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trans_", "._", "set", "Attribute_", "(_", "\"", "librar", "y", "\"_", ",_", "\"", "trans", "%", "s", "\"_", "%_", "type_", "._", "lower_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trans_", "._", "append", "Child_", "(_", "eman", "e_", "._", "xml", "param_", "(_", "trans", "doc_", ",_", "\"", "bit", "rate", "\"_", ",_", "\"", "0", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "flowc", "ontr", "ol_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "names_", "=_", "self_", "._", "model_", "._", "getn", "ames_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "values_", "=_", "eman", "e_", "._", "getcon", "fig_", "(_", "self_", "._", "obji", "d_", ",_", "self_", "._", "model_", "._", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "model_", "._", "getde", "fault", "values_", "(_", ")_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\"", "flowc", "ontr", "ole", "nable", "\"_", "in_", "names_", "and_", "values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i_", "=_", "names_", "._", "index_", "(_", "\"", "flowc", "ontr", "ole", "nable", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "model_", "._", "bool", "too", "ffo", "n_", "(_", "values_", "[_", "i_", "]_", ")_", "==_", "\"", "on", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flowc", "ontr", "ol_", "=_", "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_", "if_", "\"", "virtual", "\"_", "in_", "type_", "._", "lower_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "os_", "._", "path_", "._", "exists_", "(_", "\"/", "dev", "/", "net", "/", "tun", "\\u", "flowc", "tl", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "trans_", "._", "append", "Child_", "(_", "eman", "e_", "._", "xml", "param_", "(_", "trans", "doc_", ",_", "\"", "device", "path", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"/", "dev", "/", "net", "/", "tun", "\\u", "flowc", "tl", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "trans_", "._", "append", "Child_", "(_", "eman", "e_", "._", "xml", "param_", "(_", "trans", "doc_", ",_", "\"", "device", "path", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"/", "dev", "/", "net", "/", "tun", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "flowc", "ontr", "ol_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "trans_", "._", "append", "Child_", "(_", "eman", "e_", "._", "xml", "param_", "(_", "trans", "doc_", ",_", "\"", "flowc", "ontr", "ole", "nable", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "on", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "eman", "e_", "._", "xml", "write_", "(_", "trans", "doc_", ",_", "self_", "._", "transport", "xml", "name_", "(_", "type_", "._", "lower_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ema", "ne", "Node_", "(_", "Ema", "ne", "Net_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "transport", "xml", "name_", "(_", "self_", ",_", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Return", " ", "the", " ", "string", " ", "name", " ", "for", " ", "the", " ", "Transp", "ort", " ", "XML", " ", "file", ",", "\\", "10", ";", " ", " ", " ", " ", "e", ".", "g", ".", " ", "'", "n", "3", "trans", "virtual", ".", "xml", "'", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"", "n", "%", "stran", "s", "%", "s", ".", "xml", "\"_", "%_", "(_", "self_", "._", "obji", "d_", ",_", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ema", "ne", "Node_", "(_", "Ema", "ne", "Net_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "install", "neti", "fs_", "(_", "self_", ",_", "do", "\\u", "netn", "s_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Install", " ", "TAP", " ", "device", "s", " ", "int", "o", " ", "thei", "r", " ", "namespace", "s", ".", " ", "Thi", "s", " ", "is", " ", "don", "e", " ", "after", "\\", "10", ";", " ", " ", " ", " ", "EMA", "NE", " ", "daemon", "s", " ", "have", " ", "bee", "n", " ", "start", "ed", ",", " ", "bec", "aus", "e", " ", "tha", "t", " ", "is", " ", "thei", "r", " ", "only", " ", "chan", "ce", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "bind", " ", "to", " ", "the", " ", "TAP", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "session_", "._", "eman", "e_", "._", "gen", "location", "events_", "(_", ")_", "and_", "self_", "._", "session_", "._", "eman", "e_", "._", "service_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warn", "txt_", "=_", "\"", "una", "ble", " ", "to", " ", "publi", "sh", " ", "EMA", "NE", " ", "events", " ", "bec", "aus", "e", " ", "the", " ", "events", "ervice", " ", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "warn", "txt_", "+=_", "\"", "Pyth", "on", " ", "bindi", "ngs", " ", "fail", "ed", " ", "to", " ", "load", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "session_", "._", "exception_", "(_", "core", "api_", "._", "CORE", "\\u", "EXC", "P", "\\u", "LE", "VEL", "\\u", "ERROR_", ",_", "self_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "obji", "d_", ",_", "warn", "txt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "neti", "f_", "in_", "self_", "._", "neti", "fs_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "do", "\\u", "netn", "s_", "and_", "\"", "virtual", "\"_", "in_", "neti", "f_", "._", "transport", "\\u", "type_", "._", "lower_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "neti", "f_", "._", "install_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "neti", "f_", "._", "seta", "ddr", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "session_", "._", "eman", "e_", "._", "gen", "location", "events_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "neti", "f_", "._", "pos", "hook_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "at", " ", "this", " ", "point", " ", "we", " ", "register", " ", "location", " ", "handler", "s", " ", "for", " ", "generat", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "EMA", "NE", " ", "location", " ", "events_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "neti", "f_", "._", "pos", "hook_", "=_", "self_", "._", "setn", "emp", "osition", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "x_", ",_", "y_", ",_", "z_", ")_", "=_", "neti", "f_", "._", "node_", "._", "position_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "setn", "emp", "osition", "_", "(_", "neti", "f_", ",_", "x_", ",_", "y_", ",_", "z_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ema", "ne", "Node_", "(_", "Ema", "ne", "Net_", ")_", ":_", "\\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_", "dei", "nstal", "ln", "eti", "fs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Unin", "stall", " ", "TAP", " ", "device", "s", ".", " ", "Thi", "s", " ", "invoke", "s", " ", "thei", "r", " ", "shut", "down", " ", "method", " ", "for", "\\", "10", ";", " ", " ", " ", " ", "any", " ", "require", "d", " ", "clean", "up", ";", " ", "the", " ", "device", " ", "may", " ", "be", " ", "actual", "ly", " ", "remove", "d", " ", "whe", "n", "\\", "10", ";", " ", " ", " ", " ", "eman", "etr", "ans", "port", "d", " ", "terminate", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "neti", "f_", "in_", "self_", "._", "neti", "fs_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\"", "virtual", "\"_", "in_", "neti", "f_", "._", "transport", "\\u", "type_", "._", "lower_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "neti", "f_", "._", "shutdown_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "neti", "f_", "._", "pos", "hook_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ema", "ne", "Node_", "(_", "Ema", "ne", "Net_", ")_", ":_", "\\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_", "setn", "emp", "osition", "_", "(_", "self_", ",_", "neti", "f_", ",_", "x_", ",_", "y_", ",_", "z_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Publish", " ", "a", " ", "NE", "M", " ", "location", " ", "change", " ", "event", " ", "usi", "ng", " ", "the", " ", "EMA", "NE", " ", "event", " ", "service", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "session_", "._", "eman", "e_", "._", "service_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "info_", "(_", "\"", "position", " ", "service", " ", "not", " ", "avail", "able", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "nem", "id_", "=_", "self_", "._", "getne", "mid_", "(_", "neti", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ifname_", "=_", "neti", "f_", "._", "local", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "nem", "id_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "info_", "(_", "\"", "nem", "id", " ", "for", " ", "%", "s", " ", "is", " ", "unknown", "\"_", "%_", "ifname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "(_", "lat_", ",_", "long_", ",_", "alt_", ")_", "=_", "self_", "._", "session_", "._", "location_", "._", "getg", "eo_", "(_", "x_", ",_", "y_", ",_", "z_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "info_", "(_", "\"", "setn", "emp", "osition", " ", "%", "s", " ", "(%", "s", ")", " ", "x", ",", "y", ",", "z", "=(", "%", "d", ",%", "d", ",%", "s", ")\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"(", "%", ".6", "f", ",%", ".6", "f", ",%", ".6", "f", ")\"_", "%_", "(_", "ifname_", ",_", "nem", "id_", ",_", "x_", ",_", "y_", ",_", "z_", ",_", "lat_", ",_", "long_", ",_", "alt_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "session_", "._", "eman", "e_", "._", "version_", ">=_", "self_", "._", "session_", "._", "eman", "e_", "._", "EMA", "NE", "091", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "event_", "=_", "Locat", "ion", "Event_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "event_", "=_", "eman", "ee", "vent", "location_", "._", "Event", "Location_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "alti", "tude", " ", "must", " ", "be", " ", "an", " ", "integ", "er", " ", "or", " ", "warn", "ing", " ", "is", " ", "printed", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "unu", "sed", ":", " ", "yaw", ",", " ", "pitch", ",", " ", "roll", ",", " ", "azimuth", ",", " ", "elevat", "ion", ",", " ", "velocity_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "alt_", "=_", "int_", "(_", "round_", "(_", "alt_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "session_", "._", "eman", "e_", "._", "version_", ">=_", "self_", "._", "session_", "._", "eman", "e_", "._", "EMA", "NE", "091", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "event_", "._", "append_", "(_", "nem", "id_", ",_", "latitude_", "=_", "lat_", ",_", "longitude_", "=_", "long_", ",_", "altitude_", "=_", "alt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "session_", "._", "eman", "e_", "._", "service_", "._", "publish_", "(_", "0_", ",_", "event_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "event_", "._", "set_", "(_", "0_", ",_", "nem", "id_", ",_", "lat_", ",_", "long_", ",_", "alt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "session_", "._", "eman", "e_", "._", "service_", "._", "publish_", "(_", "eman", "ee", "vent", "location_", "._", "EVENT", "\\u", "ID_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "eman", "ee", "vent", "service_", "._", "PLATFORM", "ID", "\\u", "ANY_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "eman", "ee", "vent", "service_", "._", "NE", "MID", "\\u", "ANY_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "eman", "ee", "vent", "service_", "._", "COMPONENT", "ID", "\\u", "ANY_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "event_", "._", "export_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ema", "ne", "Node_", "(_", "Ema", "ne", "Net_", ")_", ":_", "\\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_", "setn", "emp", "osition", "s_", "(_", "self_", ",_", "moved", "\\u", "neti", "fs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Seve", "ral", " ", "NE", "Ms", " ", "have", " ", "moved", ",", " ", "from", " ", "e", ".", "g", ".", " ", "a", " ", "Way", "point", "Mob", "ilit", "y", "Model", "\\", "10", ";", " ", " ", " ", " ", "calculati", "on", ".", " ", "Generate", " ", "an", " ", "EMA", "NE", " ", "Locat", "ion", " ", "Event", " ", "hav", "ing", " ", "sever", "al", "\\", "10", ";", " ", " ", " ", " ", "entri", "es", " ", "for", " ", "each", " ", "neti", "f", " ", "tha", "t", " ", "has", " ", "moved", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "moved", "\\u", "neti", "fs_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "session_", "._", "eman", "e_", "._", "service_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "info_", "(_", "\"", "position", " ", "service", " ", "not", " ", "avail", "able", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "session_", "._", "eman", "e_", "._", "version_", ">=_", "self_", "._", "session_", "._", "eman", "e_", "._", "EMA", "NE", "091", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "event_", "=_", "Locat", "ion", "Event_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "event_", "=_", "eman", "ee", "vent", "location_", "._", "Event", "Location_", "(_", "len_", "(_", "moved", "\\u", "neti", "fs_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "i_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "neti", "f_", "in_", "moved", "\\u", "neti", "fs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nem", "id_", "=_", "self_", "._", "getne", "mid_", "(_", "neti", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ifname_", "=_", "neti", "f_", "._", "local", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "nem", "id_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "info_", "(_", "\"", "nem", "id", " ", "for", " ", "%", "s", " ", "is", " ", "unknown", "\"_", "%_", "ifname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "(_", "x_", ",_", "y_", ",_", "z_", ")_", "=_", "neti", "f_", "._", "node_", "._", "getp", "osition", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "lat_", ",_", "long_", ",_", "alt_", ")_", "=_", "self_", "._", "session_", "._", "location_", "._", "getg", "eo_", "(_", "x_", ",_", "y_", ",_", "z_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "info_", "(_", "\"", "setn", "emp", "osition", "s", " ", "%", "d", " ", "%", "s", " ", "(%", "s", ")", " ", "x", ",", "y", ",", "z", "=(", "%", "d", ",%", "d", ",%", "s", ")\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"(", "%", ".6", "f", ",%", ".6", "f", ",%", ".6", "f", ")\"_", "%_", "(_", "i_", ",_", "ifname_", ",_", "nem", "id_", ",_", "x_", ",_", "y_", ",_", "z_", ",_", "lat_", ",_", "long_", ",_", "alt_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "alti", "tude", " ", "must", " ", "be", " ", "an", " ", "integ", "er", " ", "or", " ", "warn", "ing", " ", "is", " ", "printed", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "alt_", "=_", "int_", "(_", "round_", "(_", "alt_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "session_", "._", "eman", "e_", "._", "version_", ">=_", "self_", "._", "session_", "._", "eman", "e_", "._", "EMA", "NE", "091", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "event_", "._", "append_", "(_", "nem", "id_", ",_", "latitude_", "=_", "lat_", ",_", "longitude_", "=_", "long_", ",_", "altitude_", "=_", "alt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "event_", "._", "set_", "(_", "i_", ",_", "nem", "id_", ",_", "lat_", ",_", "long_", ",_", "alt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "i_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "session_", "._", "eman", "e_", "._", "version_", ">=_", "self_", "._", "session_", "._", "eman", "e_", "._", "EMA", "NE", "091", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "session_", "._", "eman", "e_", "._", "service_", "._", "publish_", "(_", "0_", ",_", "event_", ")_", "\\u\\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_", "._", "session_", "._", "eman", "e_", "._", "service_", "._", "publish_", "(_", "eman", "ee", "vent", "location_", "._", "EVENT", "\\u", "ID_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "eman", "ee", "vent", "service_", "._", "PLATFORM", "ID", "\\u", "ANY_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "eman", "ee", "vent", "service_", "._", "NE", "MID", "\\u", "ANY_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "eman", "ee", "vent", "service_", "._", "COMPONENT", "ID", "\\u", "ANY_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "event_", "._", "export_", "(_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
CountZer0/PipelineConstructionSet/python/maya/site-packages/pymel-1.0.5/pymel/util/objectParser.py
[ { "content": "def currentfn() :\n try :\n return sys._getframe(1).f_code.co_name\n except :\n pass", "metadata": "root.currentfn", "header": "['module', '___EOS___']", "index": 38 }, { "content": " @classmethod\n def classparserbuild(cls, **kwargs):\n \"\"\" Inits class Parser, all instances of a Parsed class share the same yacc parser object \"\"\"\n\n clsname = cls.__name__\n try :\n # class declaration specifies a parser class\n parser = cls._parser\n except :\n # default rule\n parsername = cls.__name__+\"Parser\"\n parser = Parser.classes.get(parsername, None)\n cls._parser = parser\n warnings.warn (\"could not read '_parser' for %s, building Parser name %s from Parsed class name %s\" % (cls, parsername, clsname), UserWarning)\n\n if parser is not None :\n # if parser hasn't been built yet, build it\n if not isinstance(parser, Parser) :\n # parser is a class\n if inspect.isclass(parser) :\n parsername = parser.__name__\n if not issubclass (parser, Parser):\n raise ValueError, \"Parser %s specified in Parsed class %s is not a Parser class\" % (parsername, cls.__name__)\n # parser is a string\n elif parser in Parser.classes :\n parsername = parser\n parser = Parser.classes[parsername]\n else :\n raise ValueError, \"Invalid Parser specification %r in Parsed class %s\" % (parser, cls.__name__)\n\n # build class Parser, replace class _parser by the Parser instance object\n\n # print \"Building parser instance of Parser %s for Parsed class: %s\" % (parser, cls.__name__)\n # replace _parser attribute (which held a Parser class or classname) with parser class instance\n cls._parser = parser()\n cls._parser.build(**kwargs)\n # return cls._parser\n else :\n raise TypeError, \"Parsed class %s does not define a parser, check declarations\" % cls.__name__", "metadata": "root.Parsed.classparserbuild", "header": "['class', 'Parsed', '(', 'ProxyUni', ')', ':', '___EOS___']", "index": 98 }, { "content": " def __new__(cls, *args, **kwargs):\n \"\"\" Creation of a Parsed object from a LexToken, other Parsed of compatible type or string,\n if a string is passed it will be parsed and checked for compatibility with this Parsed type \"\"\"\n\n debug = kwargs.get('debug', verbose())\n # type checking\n data = None\n if args :\n if len(args) == 1:\n data = args[0]\n else :\n data = tuple(args)\n\n # some data (when initializing from single arg) can define the type of Parsed object to be created\n ptype = None\n if data is None :\n # only authorize Empty to be built without arguments\n ptype = 'Empty'\n elif isinstance(data, lex.LexToken) :\n ptype = kwargs.get('type', data.type)\n elif isinstance(data, Parsed) :\n ptype = data.__class__\n # can override type with the keyword 'type'\n ptype=kwargs.get('type', ptype)\n\n if (cls is Parsed or cls is Token) : #issubclass(cls, Token) ):\n if ptype is not None :\n if verbose():\n print \"__new__ called on Parsed/Token %s with type %r\" % (cls.__name__, ptype)\n newcls = Parsed.classes.get(ptype, None)\n # can only specify an existing subclass of cls\n if newcls is None :\n raise TypeError, \"Type %s does not correspond to any existing Parsed sub-class (%s does not exist)\" % (ptype, cls.__name__ )\n else :\n clsname = newcls.__name__\n if not issubclass(newcls, cls) :\n raise TypeError, \"Type %s would create a class %s that is not a sub-class of the class %s that __new__ was called on\" % (ptype, clsname, cls.__name__)\n else :\n raise TypeError, \"Class %s is an abstract class and can't be created directly, you must specify a valid sub-type\" % (cls.__name__)\n else :\n if verbose():\n print \"__new__ called on explicit class %s\" % (cls.__name__)\n clsname = cls.__name__\n newcls = cls\n\n # print \"Creating new instance of Parsed class: %r\" % newcls\n\n # process arguments and build, check arguments compatibility with that type\n pos = None\n sub = []\n valid = False\n value = data\n\n #if debug : print \"VALUE1\", value, repr(value)\n\n # special case for LexToken\n if isinstance(data, lex.LexToken) :\n if issubclass(newcls, Token) :\n # from a unique lex Token, do not check if also creating a Token\n sub = []\n pos = data.lexpos\n value = data.value\n valid = True\n else :\n # build a Token from it\n value = Token(data.value, ptype=data.type, pos=data.pos)\n\n if data is None :\n # Tokens can have default value to allow initialization without arguments\n try :\n value = newcls.default()\n valid = True\n except :\n valid = False\n elif isinstance(data, newcls) :\n #if debug : print \"IS INSTANCE\", data, repr(data)\n # from a similar class, copy it\n sub = data.sub\n pos = data.pos\n valid = data.isValid()\n value = unicode(data)\n elif newcls.accepts(data) :\n #if debug : print \"ACCEPTS\", data, repr(data)\n # from a compatible Parsed sub class, build the sub list from it\n sub.append(data)\n pos = data.pos\n valid = data.isValid()\n value = unicode(data)\n elif isSequence(data) and not isinstance(data, basestring):\n # building from sub parts, must be of the same type and in class _accepts\n # TODO : use yacc own rules for accepts\n if data :\n valid = True\n p = 0\n for arg in data :\n # converts LexTokens directly\n if isinstance(arg, lex.LexToken) :\n a = Token(arg.value, ptype=arg.type, pos=data.pos)\n else :\n a = arg\n # now check if it's a suitable sub-part or derived class\n if isinstance(a, newcls) :\n sub += a.sub\n elif newcls.accepts(a) :\n sub.append(a)\n else :\n valid = False\n break\n value = u\"\".join(map(unicode, data))\n if valid :\n pos = sub[0].pos\n else :\n sub = []\n else :\n value = ''\n else :\n if debug : print \"REPARSE\", data, repr(data)\n # reparse unless it's a Token we already know the type of\n value = unicode(data)\n if issubclass(newcls, Token) and newcls is not Token :\n sub = []\n pos = 0\n valid = True\n else :\n valid = False\n\n # parse if necessary\n if valid :\n # print \"No reparsing necessary for a resulting value %s (%r)\" % (value, value)\n strvalue = unicode(value)\n elif isinstance(value, basestring) :\n if debug :\n print \"%s: Will need to reparse value %r\" % (clsname, value)\n newcls.classparserbuild(debug=debug)\n if debug : print \"VALUE\", value, type(value)\n result = newcls.classparse(value, debug=debug)\n if debug : print \"RESULT\", result, type(result), isinstance(result, newcls)\n if result is not None and isinstance(result, newcls) :\n strvalue = unicode(result)\n valid = result._valid\n sub = result._sub\n pos = result._pos\n if debug : print \"SUB\", sub\n else :\n strvalue = ''\n valid = False\n else :\n raise TypeError, \"invalid argument(s) %r, cannot be parsed to create a Parsed object of type %s\" % (value, clsname)\n\n if valid :\n # create a unicode object with appropriate string value\n newobj = super(Parsed, cls).__new__(newcls)\n newobj._name = strvalue\n #if debug: print \"NAME\", newobj, type(newobj), sub#, inspect.getmro(newobj)\n # set instance attributes\n newobj._sub = tuple(sub)\n newobj._valid = valid\n # override for pos\n pos = kwargs.get('pos', pos)\n if pos is not None :\n pos += kwargs.get('offset', 0)\n\n if pos is None or (isinstance(pos, int) and pos>=0) :\n newobj._pos = pos\n else :\n raise ValueError, \"A Parsed pos can only be None or an unsigned int, %r invalid\" % pos\n\n return newobj", "metadata": "root.Parsed.__new__", "header": "['class', 'Parsed', '(', 'ProxyUni', ')', ':', '___EOS___']", "index": 231 }, { "content": "def isParsedClass (x) :\n try :\n return issubclass(x, Parsed)\n except :\n return False", "metadata": "root.isParsedClass", "header": "['module', '___EOS___']", "index": 634 }, { "content": "def isParserClass (x) :\n try :\n return issubclass(x, Parser)\n except :\n return False", "metadata": "root.isParserClass", "header": "['module', '___EOS___']", "index": 639 } ]
[ { "span": "except :", "start_line": 41, "start_column": 4, "end_line": 41, "end_column": 12 }, { "span": "except :", "start_line": 106, "start_column": 8, "end_line": 106, "end_column": 16 }, { "span": "except :", "start_line": 303, "start_column": 12, "end_line": 303, "end_column": 20 }, { "span": "except :", "start_line": 637, "start_column": 4, "end_line": 637, "end_column": 12 }, { "span": "except :", "start_line": 642, "start_column": 4, "end_line": 642, "end_column": 12 } ]
[]
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_", "current", "fn_", "(_", ")_", ":_", "\\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_", "sys_", "._", "\\u", "getframe_", "(_", "1_", ")_", "._", "f", "\\u", "code_", "._", "co", "\\u", "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_", "[SEP]_", "class_", "Pars", "ed_", "(_", "Pro", "xy", "Uni", "_", ")_", ":_", "\\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_", "class", "parser", "build_", "(_", "cls_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Ini", "ts", " ", "class", " ", "Parser", ",", " ", "all", " ", "instance", "s", " ", "of", " ", "a", " ", "Pars", "ed", " ", "class", " ", "share", " ", "the", " ", "same", " ", "yac", "c", " ", "parser", " ", "object", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cls", "name_", "=_", "cls_", "._", "\\u\\u", "name\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "class", " ", "declaration", " ", "speci", "fie", "s", " ", "a", " ", "parser", " ", "class_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parser_", "=_", "cls_", "._", "\\u", "parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "default", " ", "rule_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parser", "name_", "=_", "cls_", "._", "\\u\\u", "name\\u\\u_", "+_", "\"", "Parser", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "=_", "Parser_", "._", "classes_", "._", "get_", "(_", "parser", "name_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "._", "\\u", "parser_", "=_", "parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "warnings_", "._", "warn_", "(_", "\"", "coul", "d", " ", "not", " ", "read", " ", "'\\u", "parser", "'", " ", "for", " ", "%", "s", ",", " ", "buildi", "ng", " ", "Parser", " ", "name", " ", "%", "s", " ", "from", " ", "Pars", "ed", " ", "class", " ", "name", " ", "%", "s", "\"_", "%_", "(_", "cls_", ",_", "parser", "name_", ",_", "cls", "name_", ")_", ",_", "User", "Warning_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "parser_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "parser", " ", "hasn", "'", "t", " ", "bee", "n", " ", "bui", "lt", " ", "ye", "t", ",", " ", "build", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "parser_", ",_", "Parser_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "parser", " ", "is", " ", "a", " ", "class_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "inspect_", "._", "iscl", "ass_", "(_", "parser_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "parser", "name_", "=_", "parser_", "._", "\\u\\u", "name\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "issubclass_", "(_", "parser_", ",_", "Parser_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "Value", "Error_", ",_", "\"", "Parser", " ", "%", "s", " ", "specified", " ", "in", " ", "Pars", "ed", " ", "class", " ", "%", "s", " ", "is", " ", "not", " ", "a", " ", "Parser", " ", "class", "\"_", "%_", "(_", "parser", "name_", ",_", "cls_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "parser", " ", "is", " ", "a", " ", "string_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "parser_", "in_", "Parser_", "._", "classes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "parser", "name_", "=_", "parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "=_", "Parser_", "._", "classes_", "[_", "parser", "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 ", " ", "_", "raise_", "Value", "Error_", ",_", "\"", "Inva", "lid", " ", "Parser", " ", "specifica", "tion", " ", "%", "r", " ", "in", " ", "Pars", "ed", " ", "class", " ", "%", "s", "\"_", "%_", "(_", "parser_", ",_", "cls_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "build", " ", "class", " ", "Parser", ",", " ", "replace", " ", "class", " ", "\\u", "parser", " ", "by", " ", "the", " ", "Parser", " ", "instance", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "\"", "Building", " ", "parser", " ", "instance", " ", "of", " ", "Parser", " ", "%", "s", " ", "for", " ", "Pars", "ed", " ", "class", ":", " ", "%", "s", "\"", " ", "%", " ", "(", "parser", ",", " ", "cls", ".\\u", "\\u", "name", "\\u\\u)", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "replace", " ", "\\u", "parser", " ", "attribute", " ", "(", "whi", "ch", " ", "hel", "d", " ", "a", " ", "Parser", " ", "class", " ", "or", " ", "class", "name", ")", " ", "with", " ", "parser", " ", "class", " ", "instance_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cls_", "._", "\\u", "parser_", "=_", "parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "._", "\\u", "parser_", "._", "build_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "return", " ", "cls", ".\\u", "parser_", "\\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_", "Type", "Error_", ",_", "\"", "Pars", "ed", " ", "class", " ", "%", "s", " ", "doe", "s", " ", "not", " ", "defin", "e", " ", "a", " ", "parser", ",", " ", "check", " ", "declaration", "s", "\"_", "%_", "cls_", "._", "\\u\\u", "name\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pars", "ed_", "(_", "Pro", "xy", "Uni", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "new\\u\\u_", "(_", "cls_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Creat", "ion", " ", "of", " ", "a", " ", "Pars", "ed", " ", "object", " ", "from", " ", "a", " ", "Lex", "Token", ",", " ", "other", " ", "Pars", "ed", " ", "of", " ", "compatible", " ", "type", " ", "or", " ", "string", ",", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "a", " ", "string", " ", "is", " ", "pass", "ed", " ", "it", " ", "will", " ", "be", " ", "parsed", " ", "and", " ", "checke", "d", " ", "for", " ", "compatibility", " ", "with", " ", "this", " ", "Pars", "ed", " ", "type", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "debug_", "=_", "kwargs_", "._", "get_", "(_", "'", "debug", "'_", ",_", "verbose_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "type", " ", "checking", "_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "args_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "tuple_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "some", " ", "data", " ", "(", "whe", "n", " ", "initiali", "zin", "g", " ", "from", " ", "single", " ", "arg", ")", " ", "can", " ", "defin", "e", " ", "the", " ", "type", " ", "of", " ", "Pars", "ed", " ", "object", " ", "to", " ", "be", " ", "created_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ptype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "data_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "only", " ", "authoriz", "e", " ", "Emp", "ty", " ", "to", " ", "be", " ", "bui", "lt", " ", "with", "out", " ", "arguments_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ptype_", "=_", "'", "Emp", "ty", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "data_", ",_", "lex_", "._", "Lex", "Token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ptype_", "=_", "kwargs_", "._", "get_", "(_", "'", "type", "'_", ",_", "data_", "._", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "data_", ",_", "Pars", "ed_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ptype_", "=_", "data_", "._", "\\u\\u", "class\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "can", " ", "override", " ", "type", " ", "with", " ", "the", " ", "keyw", "ord", " ", "'", "type", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ptype_", "=_", "kwargs_", "._", "get_", "(_", "'", "type", "'_", ",_", "ptype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "cls_", "is_", "Pars", "ed_", "or_", "cls_", "is_", "Token_", ")_", ":_", "#", "issu", "bc", "lass", "(", "cls", ",", " ", "Token", ")", " ", "):", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ptype_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "verbose_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "\"\\u\\u", "new", "\\u\\u", " ", "call", "ed", " ", "on", " ", "Pars", "ed", "/", "Token", " ", "%", "s", " ", "with", " ", "type", " ", "%", "r", "\"_", "%_", "(_", "cls_", "._", "\\u\\u", "name\\u\\u_", ",_", "ptype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "newc", "ls_", "=_", "Pars", "ed_", "._", "classes_", "._", "get_", "(_", "ptype_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "can", " ", "only", " ", "speci", "fy", " ", "an", " ", "exist", "ing", " ", "subclass", " ", "of", " ", "cls_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "newc", "ls_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Type", "Error_", ",_", "\"", "Type", " ", "%", "s", " ", "doe", "s", " ", "not", " ", "correspond", " ", "to", " ", "any", " ", "exist", "ing", " ", "Pars", "ed", " ", "sub", "-", "class", " ", "(%", "s", " ", "doe", "s", " ", "not", " ", "exist", ")\"_", "%_", "(_", "ptype_", ",_", "cls_", "._", "\\u\\u", "name\\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 ", " ", "_", "cls", "name_", "=_", "newc", "ls_", "._", "\\u\\u", "name\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "issubclass_", "(_", "newc", "ls_", ",_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Type", "Error_", ",_", "\"", "Type", " ", "%", "s", " ", "wou", "ld", " ", "create", " ", "a", " ", "class", " ", "%", "s", " ", "tha", "t", " ", "is", " ", "not", " ", "a", " ", "sub", "-", "class", " ", "of", " ", "the", " ", "class", " ", "%", "s", " ", "tha", "t", " ", "\\u\\u", "new", "\\u\\u", " ", "was", " ", "call", "ed", " ", "on", "\"_", "%_", "(_", "ptype_", ",_", "cls", "name_", ",_", "cls_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", ",_", "\"", "Class", " ", "%", "s", " ", "is", " ", "an", " ", "abstract", " ", "class", " ", "and", " ", "can", "'", "t", " ", "be", " ", "created", " ", "direct", "ly", ",", " ", "you", " ", "must", " ", "speci", "fy", " ", "a", " ", "valid", " ", "sub", "-", "type", "\"_", "%_", "(_", "cls_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\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_", "verbose_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"\\u\\u", "new", "\\u\\u", " ", "call", "ed", " ", "on", " ", "explicit", " ", "class", " ", "%", "s", "\"_", "%_", "(_", "cls_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cls", "name_", "=_", "cls_", "._", "\\u\\u", "name\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newc", "ls_", "=_", "cls_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "\"", "Creat", "ing", " ", "new", " ", "instance", " ", "of", " ", "Pars", "ed", " ", "class", ":", " ", "%", "r", "\"", " ", "%", " ", "newc", "ls_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "process", " ", "argu", "ment", "s", " ", "and", " ", "build", ",", " ", "check", " ", "argu", "ment", "s", " ", "compatibility", " ", "with", " ", "tha", "t", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pos_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sub_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valid_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "debug", " ", ":", " ", "print", " ", "\"", "VALU", "E1", "\",", " ", "value", ",", " ", "repr", "(", "value", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "special", " ", "case", " ", "for", " ", "Lex", "Token_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "data_", ",_", "lex_", "._", "Lex", "Token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "issubclass_", "(_", "newc", "ls_", ",_", "Token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "from", " ", "a", " ", "unique", " ", "lex", " ", "Token", ",", " ", "do", " ", "not", " ", "check", " ", "if", " ", "als", "o", " ", "creati", "ng", " ", "a", " ", "Token_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sub_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pos_", "=_", "data_", "._", "lex", "pos_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "data_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valid_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "build", " ", "a", " ", "Token", " ", "from", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "Token_", "(_", "data_", "._", "value_", ",_", "ptype_", "=_", "data_", "._", "type_", ",_", "pos_", "=_", "data_", "._", "pos_", ")_", "\\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_", "data_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Token", "s", " ", "can", " ", "have", " ", "default", " ", "value", " ", "to", " ", "allow", " ", "initialization", " ", "with", "out", " ", "arguments_", "\\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 ", " _", "value_", "=_", "newc", "ls_", "._", "default_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valid_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "valid_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "data_", ",_", "newc", "ls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "debug", " ", ":", " ", "print", " ", "\"", "IS", " ", "INSTANCE", "\",", " ", "data", ",", " ", "repr", "(", "data", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "from", " ", "a", " ", "similar", " ", "class", ",", " ", "copy", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sub_", "=_", "data_", "._", "sub_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pos_", "=_", "data_", "._", "pos_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valid_", "=_", "data_", "._", "is", "Valid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "unicode_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "newc", "ls_", "._", "accepts", "_", "(_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "debug", " ", ":", " ", "print", " ", "\"", "ACCEPT", "S", "\",", " ", "data", ",", " ", "repr", "(", "data", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "from", " ", "a", " ", "compatible", " ", "Pars", "ed", " ", "sub", " ", "class", ",", " ", "build", " ", "the", " ", "sub", " ", "list", " ", "from", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sub_", "._", "append_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pos_", "=_", "data_", "._", "pos_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valid_", "=_", "data_", "._", "is", "Valid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "unicode_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "is", "Sequence_", "(_", "data_", ")_", "and_", "not_", "isinstance_", "(_", "data_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "buildi", "ng", " ", "from", " ", "sub", " ", "part", "s", ",", " ", "must", " ", "be", " ", "of", " ", "the", " ", "same", " ", "type", " ", "and", " ", "in", " ", "class", " ", "\\u", "accepts", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", ":", " ", "use", " ", "yac", "c", " ", "own", " ", "rule", "s", " ", "for", " ", "accepts", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "valid_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "arg_", "in_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "convert", "s", " ", "Lex", "Token", "s", " ", "direct", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "isinstance_", "(_", "arg_", ",_", "lex_", "._", "Lex", "Token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "a_", "=_", "Token_", "(_", "arg_", "._", "value_", ",_", "ptype_", "=_", "arg_", "._", "type_", ",_", "pos_", "=_", "data_", "._", "pos_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "a_", "=_", "arg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "now", " ", "check", " ", "if", " ", "it", "'", "s", " ", "a", " ", "suit", "able", " ", "sub", "-", "part", " ", "or", " ", "derive", "d", " ", "class_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "a_", ",_", "newc", "ls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "sub_", "+=_", "a_", "._", "sub_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "newc", "ls_", "._", "accepts", "_", "(_", "a_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "sub_", "._", "append_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "valid_", "=_", "False_", "\\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_", "value_", "=_", "u", "\"\"_", "._", "join_", "(_", "map_", "(_", "unicode_", ",_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "valid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pos_", "=_", "sub_", "[_", "0_", "]_", "._", "pos_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sub_", "=_", "[_", "]_", "\\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 ", " _", "value_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "debug_", ":_", "print_", "\"", "REP", "AR", "SE", "\"_", ",_", "data_", ",_", "repr_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "repar", "se", " ", "unl", "ess", " ", "it", "'", "s", " ", "a", " ", "Token", " ", "we", " ", "alr", "ead", "y", " ", "know", " ", "the", " ", "type", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "value_", "=_", "unicode_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "issubclass_", "(_", "newc", "ls_", ",_", "Token_", ")_", "and_", "newc", "ls_", "is_", "not_", "Token_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sub_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pos_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valid_", "=_", "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 ", " _", "valid_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "parse", " ", "if", " ", "necessar", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "valid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", " ", "\"", "No", " ", "repar", "sing", " ", "necessar", "y", " ", "for", " ", "a", " ", "result", "ing", " ", "value", " ", "%", "s", " ", "(%", "r", ")\"", " ", "%", " ", "(", "value", ",", " ", "value", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "str", "value_", "=_", "unicode_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "value_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "debug_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"%", "s", ":", " ", "Wil", "l", " ", "need", " ", "to", " ", "repar", "se", " ", "value", " ", "%", "r", "\"_", "%_", "(_", "cls", "name_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "newc", "ls_", "._", "class", "parser", "build_", "(_", "debug_", "=_", "debug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "debug_", ":_", "print_", "\"", "VALU", "E", "\"_", ",_", "value_", ",_", "type_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "newc", "ls_", "._", "class", "parse_", "(_", "value_", ",_", "debug_", "=_", "debug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "debug_", ":_", "print_", "\"", "RESU", "LT", "\"_", ",_", "result_", ",_", "type_", "(_", "result_", ")_", ",_", "isinstance_", "(_", "result_", ",_", "newc", "ls_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "result_", "is_", "not_", "None_", "and_", "isinstance_", "(_", "result_", ",_", "newc", "ls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "str", "value_", "=_", "unicode_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valid_", "=_", "result_", "._", "\\u", "valid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sub_", "=_", "result_", "._", "\\u", "sub_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pos_", "=_", "result_", "._", "\\u", "pos_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "debug_", ":_", "print_", "\"", "SUB", "\"_", ",_", "sub_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "str", "value_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valid_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", ",_", "\"", "invalid", " ", "argu", "ment", "(", "s", ")", " ", "%", "r", ",", " ", "cann", "ot", " ", "be", " ", "parsed", " ", "to", " ", "create", " ", "a", " ", "Pars", "ed", " ", "object", " ", "of", " ", "type", " ", "%", "s", "\"_", "%_", "(_", "value_", ",_", "cls", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "valid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "create", " ", "a", " ", "unicode", " ", "object", " ", "with", " ", "appropr", "iate", " ", "string", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "newo", "bj_", "=_", "super_", "(_", "Pars", "ed_", ",_", "cls_", ")_", "._", "\\u\\u", "new\\u\\u_", "(_", "newc", "ls_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newo", "bj_", "._", "\\u", "name_", "=_", "str", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "debug", ":", " ", "print", " ", "\"", "NAME", "\",", " ", "newo", "bj", ",", " ", "type", "(", "newo", "bj", "),", " ", "sub", "#", ",", " ", "inspect", ".", "getm", "ro", "(", "newo", "bj", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "set", " ", "instance", " ", "attributes_", "\\u\\u\\uNL\\u\\u\\u_", "newo", "bj_", "._", "\\u", "sub_", "=_", "tuple_", "(_", "sub_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newo", "bj_", "._", "\\u", "valid_", "=_", "valid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "override", " ", "for", " ", "pos_", "\\u\\u\\uNL\\u\\u\\u_", "pos_", "=_", "kwargs_", "._", "get_", "(_", "'", "pos", "'_", ",_", "pos_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pos_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pos_", "+=_", "kwargs_", "._", "get_", "(_", "'", "offset", "'_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "pos_", "is_", "None_", "or_", "(_", "isinstance_", "(_", "pos_", ",_", "int_", ")_", "and_", "pos_", ">=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "newo", "bj_", "._", "\\u", "pos_", "=_", "pos_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", ",_", "\"", "A", " ", "Pars", "ed", " ", "pos", " ", "can", " ", "only", " ", "be", " ", "Non", "e", " ", "or", " ", "an", " ", "unsigned", " ", "int", ",", " ", "%", "r", " ", "invalid", "\"_", "%_", "pos_", "\\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_", "newo", "bj_", "\\u\\u\\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_", "is", "Pars", "ed", "Class_", "(_", "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_", "issubclass_", "(_", "x_", ",_", "Pars", "ed_", ")_", "\\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_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "Parser", "Class_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Except block handles 'BaseException'
zorna/zorna/zorna/forms/api.py
[ { "content": "def isUserManager(request, slug):\n try:\n fw = FormsWorkspace.objects.get(slug=slug)\n ao = get_allowed_objects(request.user, FormsWorkspace, 'manager')\n if fw.pk in ao:\n return fw\n else:\n return False\n except:\n return False", "metadata": "root.isUserManager", "header": "['module', '___EOS___']", "index": 19 }, { "content": "def forms_get_form_edit_entry(request, entry):\n try:\n entry = FormsFormEntry.objects.get(pk=entry)\n form = entry.form\n except:\n return None\n\n rget = request.GET # {'lot.designation': '110'}\n args = (form, request.POST or None, request.FILES or None)\n form_for_form = FormForForm(*args, instance=entry, rget=rget)\n return form_for_form", "metadata": "root.forms_get_form_edit_entry", "header": "['module', '___EOS___']", "index": 68 }, { "content": "def forms_form_browse_entries(request, slug, entries=None):\n try:\n form = FormsForm.objects.select_related(depth=1).get(slug=slug)\n except:\n return None\n\n # dont't verify access, caller must do it for us\n extra_context = {}\n kwargs = {}\n sort = ''\n if entries:\n kwargs['entries'] = entries\n extra_context['filters'] = {}\n extra_context['field_filters'] = []\n form_fields = form.fields.select_related().all().order_by('label')\n form.fields_reference = {}\n hidden = request.GET.get('hidden', '')\n if hidden:\n hidden = hidden.split(',')\n else:\n hidden = []\n for f in form_fields:\n fl = request.GET.get(f.slug, None)\n if fl:\n kwargs[f.slug] = smart_str(fl)\n if f.for_sort:\n sort = f.slug\n if not f.visible_in_list:\n hidden.append(f.slug)\n extra_context['params'] = urllib.urlencode(kwargs)\n\n kwargs['f'] = request.GET.get('f', '')\n kwargs['q'] = request.GET.get('q', '')\n kwargs['o'] = request.GET.get('o', sort)\n kwargs['ot'] = request.GET.get('ot', 'asc')\n kwargs['where'] = request.GET.get('where', '')\n\n extra_context['parents'] = []\n if kwargs['where']:\n try:\n bte = kwargs['where'].split(':')\n extra_context['where_entry_id'] = entry_id = bte[1]\n bte = bte[0].split('.')\n extra_context['where_form_slug'] = form_slug = bte[0]\n extra_context['where_form_field'] = form_field = bte[1]\n while entry_id:\n e = FormsFormEntry.objects.select_related().get(\n pk=entry_id, form__slug=form_slug)\n c, r = forms_get_entry(e)\n extra_context['parents'].append({'row': r[\n form_field], 'entry': e})\n hidden.append(r[form_field]['slug'])\n if not e.form.bind_to_entry:\n break\n bte = e.form.bind_to_entry.split('.')\n form_slug = bte[0]\n form_field = bte[1]\n entry_id = e.entry.pk\n except Exception as e:\n extra_context['parents'] = []\n extra_context['parents'].reverse()\n kwargs['hidden'] = ','.join(hidden)\n\n columns, entries = forms_get_entries(form, **kwargs)\n for f in form_fields:\n if '.' in f.reference and f.is_a(*fields.CHOICES):\n fl = request.GET.get(f.slug, None)\n choices = [('', '--- %s ---' % f.label)]\n for e in form.fields_reference[f.pk]:\n choices.append((e[0], e[1]))\n s = forms.Select(choices=choices)\n extra_context['filters'][f.label] = s.render(f.slug, fl, None)\n else:\n extra_context['field_filters'].append([f.label, f.slug])\n if fl:\n kwargs[f.slug] = fl\n\n paginator = Paginator(entries, 25)\n page = int(request.GET.get('page', 1))\n try:\n rows = paginator.page(page)\n except PageNotAnInteger:\n # If page is not an integer, deliver first page.\n rows = paginator.page(1)\n except EmptyPage:\n # If page is out of range (e.g. 9999), deliver last page of results.\n rows = paginator.page(paginator.num_pages)\n\n extra_context['q'] = kwargs['q']\n extra_context['f'] = kwargs['f']\n extra_context['column_filter'] = kwargs['o']\n extra_context['column_order'] = kwargs['ot']\n extra_context['zorna_title_page'] = _(u'Forms')\n extra_context['form'] = form\n extra_context['columns'] = columns\n extra_context['entries'] = entries\n extra_context['rows'] = rows\n extra_context['page'] = page\n extra_context['paginator'] = paginator\n extra_context['where'] = kwargs['where']\n try:\n r = form.bind_to_entry.split('.')\n extra_context['bind_entry_slug'] = r[0]\n extra_context['bind_entry_field'] = r[1]\n except:\n pass\n\n extra_context['where'] = kwargs['where']\n\n return extra_context", "metadata": "root.forms_form_browse_entries", "header": "['module', '___EOS___']", "index": 117 } ]
[ { "span": "except:", "start_line": 27, "start_column": 4, "end_line": 27, "end_column": 11 }, { "span": "except:", "start_line": 72, "start_column": 4, "end_line": 72, "end_column": 11 }, { "span": "except:", "start_line": 120, "start_column": 4, "end_line": 120, "end_column": 11 }, { "span": "except:", "start_line": 221, "start_column": 4, "end_line": 221, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "is", "User", "Manager_", "(_", "request_", ",_", "slug_", ")_", ":_", "\\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 ", " _", "fw_", "=_", "Form", "s", "Workspace_", "._", "objects_", "._", "get_", "(_", "slug_", "=_", "slug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ao_", "=_", "get", "\\u", "allow", "ed", "\\u", "objects_", "(_", "request_", "._", "user_", ",_", "Form", "s", "Workspace_", ",_", "'", "manage", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "fw_", "._", "pk_", "in_", "ao_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "fw_", "\\u\\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_", "\\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_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "forms", "\\u", "get", "\\u", "form", "\\u", "edit", "\\u", "entry_", "(_", "request_", ",_", "entry_", ")_", ":_", "\\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 ", " _", "entry_", "=_", "Form", "s", "Form", "Entry_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "entry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "=_", "entry_", "._", "form_", "\\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_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rget", "_", "=_", "request_", "._", "GET_", "#", " ", "{", "'", "lot", ".", "designat", "ion", "':", " ", "'", "110", "'}", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "(_", "form_", ",_", "request_", "._", "POST_", "or_", "None_", ",_", "request_", "._", "FILES_", "or_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form", "\\u", "for", "\\u", "form_", "=_", "Form", "For", "Form_", "(_", "*_", "args_", ",_", "instance_", "=_", "entry_", ",_", "rget", "_", "=_", "rget", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "form", "\\u", "for", "\\u", "form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "forms", "\\u", "form", "\\u", "browse", "\\u", "entries_", "(_", "request_", ",_", "slug_", ",_", "entries_", "=_", "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 ", " _", "form_", "=_", "Form", "s", "Form_", "._", "objects_", "._", "select", "\\u", "related_", "(_", "depth_", "=_", "1_", ")_", "._", "get_", "(_", "slug_", "=_", "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 ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "don", "t", "'", "t", " ", "verify", " ", "access", ",", " ", "caller", " ", "must", " ", "do", " ", "it", " ", "for", " ", "us_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "extra", "\\u", "context_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sort_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "entries_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "entri", "es", "'_", "]_", "=_", "entries_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "extra", "\\u", "context_", "[_", "'", "filter", "s", "'_", "]_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra", "\\u", "context_", "[_", "'", "field", "\\u", "filter", "s", "'_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form", "\\u", "fields_", "=_", "form_", "._", "fields_", "._", "select", "\\u", "related_", "(_", ")_", "._", "all_", "(_", ")_", "._", "order", "\\u", "by_", "(_", "'", "label", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "._", "fields", "\\u", "reference_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hidden_", "=_", "request_", "._", "GET_", "._", "get_", "(_", "'", "hidden", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hidden_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hidden_", "=_", "hidden_", "._", "split_", "(_", "','_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hidden_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "f_", "in_", "form", "\\u", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fl_", "=_", "request_", "._", "GET_", "._", "get_", "(_", "f_", "._", "slug_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "fl_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "f_", "._", "slug_", "]_", "=_", "smart", "\\u", "str_", "(_", "fl_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "f_", "._", "for", "\\u", "sort_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sort_", "=_", "f_", "._", "slug_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "f_", "._", "visi", "ble", "\\u", "in", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hidden_", "._", "append_", "(_", "f_", "._", "slug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "extra", "\\u", "context_", "[_", "'", "params", "'_", "]_", "=_", "urllib_", "._", "urlencode_", "(_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "kwargs_", "[_", "'", "f", "'_", "]_", "=_", "request_", "._", "GET_", "._", "get_", "(_", "'", "f", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "q", "'_", "]_", "=_", "request_", "._", "GET_", "._", "get_", "(_", "'", "q", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "o", "'_", "]_", "=_", "request_", "._", "GET_", "._", "get_", "(_", "'", "o", "'_", ",_", "sort_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "ot", "'_", "]_", "=_", "request_", "._", "GET_", "._", "get_", "(_", "'", "ot", "'_", ",_", "'", "asc", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "where", "'_", "]_", "=_", "request_", "._", "GET_", "._", "get_", "(_", "'", "where", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "extra", "\\u", "context_", "[_", "'", "parents", "'_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "kwargs_", "[_", "'", "where", "'_", "]_", ":_", "\\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 ", " _", "bt", "e_", "=_", "kwargs_", "[_", "'", "where", "'_", "]_", "._", "split_", "(_", "':'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra", "\\u", "context_", "[_", "'", "where", "\\u", "entry", "\\u", "id", "'_", "]_", "=_", "entry", "\\u", "id_", "=_", "bt", "e_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bt", "e_", "=_", "bt", "e_", "[_", "0_", "]_", "._", "split_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra", "\\u", "context_", "[_", "'", "where", "\\u", "form", "\\u", "slug", "'_", "]_", "=_", "form", "\\u", "slug_", "=_", "bt", "e_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra", "\\u", "context_", "[_", "'", "where", "\\u", "form", "\\u", "field", "'_", "]_", "=_", "form", "\\u", "field_", "=_", "bt", "e_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "entry", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "e_", "=_", "Form", "s", "Form", "Entry_", "._", "objects_", "._", "select", "\\u", "related_", "(_", ")_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "pk_", "=_", "entry", "\\u", "id_", ",_", "form", "\\u\\u", "slug_", "=_", "form", "\\u", "slug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", ",_", "r_", "=_", "forms", "\\u", "get", "\\u", "entry_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra", "\\u", "context_", "[_", "'", "parents", "'_", "]_", "._", "append_", "(_", "{_", "'", "row", "'_", ":_", "r_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "form", "\\u", "field_", "]_", ",_", "'", "entry", "'_", ":_", "e_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hidden_", "._", "append_", "(_", "r_", "[_", "form", "\\u", "field_", "]_", "[_", "'", "slug", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "e_", "._", "form_", "._", "bind", "\\u", "to", "\\u", "entry_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "bt", "e_", "=_", "e_", "._", "form_", "._", "bind", "\\u", "to", "\\u", "entry_", "._", "split_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form", "\\u", "slug_", "=_", "bt", "e_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form", "\\u", "field_", "=_", "bt", "e_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entry", "\\u", "id_", "=_", "e_", "._", "entry_", "._", "pk_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "extra", "\\u", "context_", "[_", "'", "parents", "'_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "extra", "\\u", "context_", "[_", "'", "parents", "'_", "]_", "._", "reverse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "hidden", "'_", "]_", "=_", "','_", "._", "join_", "(_", "hidden_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "columns_", ",_", "entries_", "=_", "forms", "\\u", "get", "\\u", "entries_", "(_", "form_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "f_", "in_", "form", "\\u", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'.'_", "in_", "f_", "._", "reference_", "and_", "f_", "._", "is", "\\u", "a_", "(_", "*_", "fields_", "._", "CHOICES_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fl_", "=_", "request_", "._", "GET_", "._", "get_", "(_", "f_", "._", "slug_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "choices_", "=_", "[_", "(_", "''_", ",_", "'---", " ", "%", "s", " ", "---", "'_", "%_", "f_", "._", "label_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "e_", "in_", "form_", "._", "fields", "\\u", "reference_", "[_", "f_", "._", "pk_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "choices_", "._", "append_", "(_", "(_", "e_", "[_", "0_", "]_", ",_", "e_", "[_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "=_", "forms_", "._", "Select_", "(_", "choices_", "=_", "choices_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra", "\\u", "context_", "[_", "'", "filter", "s", "'_", "]_", "[_", "f_", "._", "label_", "]_", "=_", "s_", "._", "render_", "(_", "f_", "._", "slug_", ",_", "fl_", ",_", "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 ", " _", "extra", "\\u", "context_", "[_", "'", "field", "\\u", "filter", "s", "'_", "]_", "._", "append_", "(_", "[_", "f_", "._", "label_", ",_", "f_", "._", "slug_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "fl_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "f_", "._", "slug_", "]_", "=_", "fl_", "\\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_", "paginator_", "=_", "Paginator_", "(_", "entries_", ",_", "25_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page_", "=_", "int_", "(_", "request_", "._", "GET_", "._", "get_", "(_", "'", "page", "'_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rows_", "=_", "paginator_", "._", "page_", "(_", "page_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Page", "Not", "An", "Integer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "page", " ", "is", " ", "not", " ", "an", " ", "integ", "er", ",", " ", "deliver", " ", "first", " ", "page", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rows_", "=_", "paginator_", "._", "page_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Emp", "ty", "Page_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "page", " ", "is", " ", "out", " ", "of", " ", "range", " ", "(", "e", ".", "g", ".", " ", "9999", "),", " ", "deliver", " ", "last", " ", "page", " ", "of", " ", "results", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rows_", "=_", "paginator_", "._", "page_", "(_", "paginator_", "._", "num", "\\u", "pages_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "extra", "\\u", "context_", "[_", "'", "q", "'_", "]_", "=_", "kwargs_", "[_", "'", "q", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra", "\\u", "context_", "[_", "'", "f", "'_", "]_", "=_", "kwargs_", "[_", "'", "f", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra", "\\u", "context_", "[_", "'", "column", "\\u", "filter", "'_", "]_", "=_", "kwargs_", "[_", "'", "o", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra", "\\u", "context_", "[_", "'", "column", "\\u", "order", "'_", "]_", "=_", "kwargs_", "[_", "'", "ot", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra", "\\u", "context_", "[_", "'", "zor", "na", "\\u", "title", "\\u", "page", "'_", "]_", "=_", "\\u_", "(_", "u", "'", "Form", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra", "\\u", "context_", "[_", "'", "form", "'_", "]_", "=_", "form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra", "\\u", "context_", "[_", "'", "column", "s", "'_", "]_", "=_", "columns_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra", "\\u", "context_", "[_", "'", "entri", "es", "'_", "]_", "=_", "entries_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra", "\\u", "context_", "[_", "'", "rows", "'_", "]_", "=_", "rows_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra", "\\u", "context_", "[_", "'", "page", "'_", "]_", "=_", "page_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra", "\\u", "context_", "[_", "'", "pagina", "tor", "'_", "]_", "=_", "paginator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra", "\\u", "context_", "[_", "'", "where", "'_", "]_", "=_", "kwargs_", "[_", "'", "where", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "=_", "form_", "._", "bind", "\\u", "to", "\\u", "entry_", "._", "split_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra", "\\u", "context_", "[_", "'", "bind", "\\u", "entry", "\\u", "slug", "'_", "]_", "=_", "r_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra", "\\u", "context_", "[_", "'", "bind", "\\u", "entry", "\\u", "field", "'_", "]_", "=_", "r_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "extra", "\\u", "context_", "[_", "'", "where", "'_", "]_", "=_", "kwargs_", "[_", "'", "where", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "extra", "\\u", "context_" ]
[ 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, 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,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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, 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 ]
Unused import
ardekantur/pyglet/pyglet/input/evdev.py
[ { "content": "#!/usr/bin/env python\n\n'''\n'''\n\n__docformat__ = 'restructuredtext'\n__version__ = '$Id$'\n\nimport ctypes\nimport errno\nimport os\n\nimport pyglet\nfrom pyglet.app.xlib import XlibSelectDevice\nfrom base import Device, Control, RelativeAxis, AbsoluteAxis, Button, Joystick\nfrom base import DeviceOpenException\nfrom evdev_constants import *\nfrom evdev_constants import _rel_raw_names, _abs_raw_names, _key_raw_names\n\nc = pyglet.lib.load_library('c')\n\n_IOC_NRBITS = 8\n_IOC_TYPEBITS = 8\n_IOC_SIZEBITS = 14\n_IOC_DIRBITS = 2\n\n_IOC_NRMASK = ((1 << _IOC_NRBITS)-1)\n_IOC_TYPEMASK = ((1 << _IOC_TYPEBITS)-1)\n_IOC_SIZEMASK = ((1 << _IOC_SIZEBITS)-1)\n_IOC_DIRMASK = ((1 << _IOC_DIRBITS)-1)\n\n_IOC_NRSHIFT = 0\n_IOC_TYPESHIFT = (_IOC_NRSHIFT+_IOC_NRBITS)\n_IOC_SIZESHIFT = (_IOC_TYPESHIFT+_IOC_TYPEBITS)\n_IOC_DIRSHIFT = (_IOC_SIZESHIFT+_IOC_SIZEBITS)\n\n_IOC_NONE = 0\n_IOC_WRITE = 1\n_IOC_READ = 2\n\n\n\n\n\ntime_t = ctypes.c_long\nsuseconds_t = ctypes.c_long\n\n\n\n\n\nEVIOCGVERSION = _IOR('E', 0x01, ctypes.c_int)\nEVIOCGID = _IOR('E', 0x02, input_id)\nEVIOCGNAME = _IOR_str('E', 0x06)\nEVIOCGPHYS = _IOR_str('E', 0x07)\nEVIOCGUNIQ = _IOR_str('E', 0x08)\n\n\n_abs_names = {\n ABS_X: AbsoluteAxis.X,\n ABS_Y: AbsoluteAxis.Y,\n ABS_Z: AbsoluteAxis.Z,\n ABS_RX: AbsoluteAxis.RX,\n ABS_RY: AbsoluteAxis.RY,\n ABS_RZ: AbsoluteAxis.RZ,\n ABS_HAT0X: AbsoluteAxis.HAT_X,\n ABS_HAT0Y: AbsoluteAxis.HAT_Y,\n}\n\n_rel_names = {\n REL_X: RelativeAxis.X,\n REL_Y: RelativeAxis.Y,\n REL_Z: RelativeAxis.Z,\n REL_RX: RelativeAxis.RX,\n REL_RY: RelativeAxis.RY,\n REL_RZ: RelativeAxis.RZ,\n REL_WHEEL: RelativeAxis.WHEEL,\n}\n\n\nevent_types = {\n EV_KEY: KEY_MAX,\n EV_REL: REL_MAX,\n EV_ABS: ABS_MAX,\n EV_MSC: MSC_MAX,\n EV_LED: LED_MAX,\n EV_SND: SND_MAX,\n}\n\n\n_devices = {}\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def _IOC(dir, type, nr, size):\n return ((dir << _IOC_DIRSHIFT) |\n (type << _IOC_TYPESHIFT) |\n (nr << _IOC_NRSHIFT) |\n (size << _IOC_SIZESHIFT))", "metadata": "root._IOC", "header": "['module', '___EOS___']", "index": 40 }, { "content": "def _IOR(type, nr, struct):\n request = _IOC(_IOC_READ, ord(type), nr, ctypes.sizeof(struct))\n def f(fileno):\n buffer = struct()\n if c.ioctl(fileno, request, ctypes.byref(buffer)) < 0:\n err = ctypes.c_int.in_dll(c, 'errno').value\n raise OSError(err, errno.errorcode[err])\n return buffer\n return f", "metadata": "root._IOR", "header": "['module', '___EOS___']", "index": 46 }, { "content": "def _IOR_len(type, nr):\n def f(fileno, buffer):\n request = _IOC(_IOC_READ, ord(type), nr, ctypes.sizeof(buffer))\n if c.ioctl(fileno, request, ctypes.byref(buffer)) < 0:\n err = ctypes.c_int.in_dll(c, 'errno').value\n raise OSError(err, errno.errorcode[err])\n return buffer\n return f", "metadata": "root._IOR_len", "header": "['module', '___EOS___']", "index": 56 }, { "content": "def _IOR_str(type, nr):\n g = _IOR_len(type, nr)\n def f(fileno, len=256):\n return g(fileno, ctypes.create_string_buffer(len)).value\n return f", "metadata": "root._IOR_str", "header": "['module', '___EOS___']", "index": 65 }, { "content": "class timeval(ctypes.Structure):\n _fields_ = (\n ('tv_sec', time_t),\n ('tv_usec', suseconds_t)\n )", "metadata": "root.timeval", "header": "['module', '___EOS___']", "index": 74 }, { "content": "class input_event(ctypes.Structure):\n _fields_ = (\n ('time', timeval),\n ('type', ctypes.c_uint16),\n ('code', ctypes.c_uint16),\n ('value', ctypes.c_int32)\n )", "metadata": "root.input_event", "header": "['module', '___EOS___']", "index": 80 }, { "content": "class input_id(ctypes.Structure):\n _fields_ = (\n ('bustype', ctypes.c_uint16),\n ('vendor', ctypes.c_uint16),\n ('product', ctypes.c_uint16),\n ('version', ctypes.c_uint16),\n )", "metadata": "root.input_id", "header": "['module', '___EOS___']", "index": 88 }, { "content": "class input_absinfo(ctypes.Structure):\n _fields_ = (\n ('value', ctypes.c_int32),\n ('minimum', ctypes.c_int32),\n ('maximum', ctypes.c_int32),\n ('fuzz', ctypes.c_int32),\n ('flat', ctypes.c_int32),\n )", "metadata": "root.input_absinfo", "header": "['module', '___EOS___']", "index": 96 }, { "content": "def EVIOCGBIT(fileno, ev, buffer):\n return _IOR_len('E', 0x20 + ev)(fileno, buffer)", "metadata": "root.EVIOCGBIT", "header": "['module', '___EOS___']", "index": 110 }, { "content": "def EVIOCGABS(fileno, abs):\n buffer = input_absinfo()\n return _IOR_len('E', 0x40 + abs)(fileno, buffer)", "metadata": "root.EVIOCGABS", "header": "['module', '___EOS___']", "index": 112 }, { "content": "def get_set_bits(bytes):\n bits = set()\n j = 0\n for byte in bytes:\n for i in range(8):\n if byte & 1:\n bits.add(j + i)\n byte >>= 1\n j += 8\n return bits", "metadata": "root.get_set_bits", "header": "['module', '___EOS___']", "index": 116 }, { "content": "def _create_control(fileno, event_type, event_code):\n if event_type == EV_ABS:\n raw_name = _abs_raw_names.get(event_code, 'EV_ABS(%x)' % event_code)\n name = _abs_names.get(event_code)\n absinfo = EVIOCGABS(fileno, event_code)\n value = absinfo.value\n min = absinfo.minimum\n max = absinfo.maximum\n control = AbsoluteAxis(name, min, max, raw_name)\n control._set_value(value)\n\n if name == 'hat_y':\n control.inverted = True\n elif event_type == EV_REL:\n raw_name = _rel_raw_names.get(event_code, 'EV_REL(%x)' % event_code)\n name = _rel_names.get(event_code)\n # TODO min/max?\n control = RelativeAxis(name, raw_name)\n elif event_type == EV_KEY:\n raw_name = _key_raw_names.get(event_code, 'EV_KEY(%x)' % event_code)\n name = None\n control = Button(name, raw_name)\n else:\n value = min = max = 0 # TODO\n return None\n control._event_type = event_type\n control._event_code = event_code\n return control", "metadata": "root._create_control", "header": "['module', '___EOS___']", "index": 147 }, { "content": "def _create_joystick(device):\n # Look for something with an ABS X and ABS Y axis, and a joystick 0 button\n have_x = False\n have_y = False\n have_button = False\n for control in device.controls:\n if control._event_type == EV_ABS and control._event_code == ABS_X:\n have_x = True\n elif control._event_type == EV_ABS and control._event_code == ABS_Y:\n have_y = True\n elif control._event_type == EV_KEY and \\\n control._event_code == BTN_JOYSTICK:\n have_button = True\n if not (have_x and have_y and have_button):\n return\n\n return Joystick(device)", "metadata": "root._create_joystick", "header": "['module', '___EOS___']", "index": 176 }, { "content": "class EvdevDevice(XlibSelectDevice, Device):\n _fileno = None\n \n\n\n\n\n # XlibSelectDevice interface\n\n\n", "metadata": "root.EvdevDevice", "header": "['module', '___EOS___']", "index": 203 }, { "content": " def __init__(self, display, filename):\n self._filename = filename\n\n fileno = os.open(filename, os.O_RDONLY)\n #event_version = EVIOCGVERSION(fileno).value\n\n id = EVIOCGID(fileno)\n self.id_bustype = id.bustype\n self.id_vendor = hex(id.vendor)\n self.id_product = hex(id.product)\n self.id_version = id.version\n\n name = EVIOCGNAME(fileno)\n try:\n name = name.decode('utf-8')\n except UnicodeDecodeError:\n try:\n name = name.decode('latin-1')\n except UnicodeDecodeError:\n pass\n \n try:\n self.phys = EVIOCGPHYS(fileno)\n except OSError:\n self.phys = ''\n try:\n self.uniq = EVIOCGUNIQ(fileno)\n except OSError:\n self.uniq = ''\n\n self.controls = []\n self.control_map = {}\n\n event_types_bits = (ctypes.c_byte * 4)()\n EVIOCGBIT(fileno, 0, event_types_bits)\n for event_type in get_set_bits(event_types_bits):\n if event_type not in event_types:\n continue\n max_code = event_types[event_type]\n nbytes = max_code // 8 + 1\n event_codes_bits = (ctypes.c_byte * nbytes)()\n EVIOCGBIT(fileno, event_type, event_codes_bits)\n for event_code in get_set_bits(event_codes_bits):\n control = _create_control(fileno, event_type, event_code)\n if control:\n self.control_map[(event_type, event_code)] = control \n self.controls.append(control)\n\n os.close(fileno)\n\n super(EvdevDevice, self).__init__(display, name)", "metadata": "root.EvdevDevice.__init__", "header": "['class', 'EvdevDevice', '(', 'XlibSelectDevice', ',', 'Device', ')', ':', '___EOS___']", "index": 206 }, { "content": " def open(self, window=None, exclusive=False):\n super(EvdevDevice, self).open(window, exclusive)\n\n try:\n self._fileno = os.open(self._filename, os.O_RDONLY | os.O_NONBLOCK)\n except OSError, e:\n raise DeviceOpenException(e)\n\n pyglet.app.platform_event_loop._select_devices.add(self)", "metadata": "root.EvdevDevice.open", "header": "['class', 'EvdevDevice', '(', 'XlibSelectDevice', ',', 'Device', ')', ':', '___EOS___']", "index": 258 }, { "content": " def close(self):\n super(EvdevDevice, self).close()\n\n if not self._fileno:\n return\n\n pyglet.app.platform_event_loop._select_devices.remove(self)\n os.close(self._fileno)\n self._fileno = None", "metadata": "root.EvdevDevice.close", "header": "['class', 'EvdevDevice', '(', 'XlibSelectDevice', ',', 'Device', ')', ':', '___EOS___']", "index": 268 }, { "content": " def get_controls(self):\n return self.controls", "metadata": "root.EvdevDevice.get_controls", "header": "['class', 'EvdevDevice', '(', 'XlibSelectDevice', ',', 'Device', ')', ':', '___EOS___']", "index": 278 }, { "content": " def fileno(self):\n return self._fileno", "metadata": "root.EvdevDevice.fileno", "header": "['class', 'EvdevDevice', '(', 'XlibSelectDevice', ',', 'Device', ')', ':', '___EOS___']", "index": 283 }, { "content": " def poll(self):\n # TODO\n return False", "metadata": "root.EvdevDevice.poll", "header": "['class', 'EvdevDevice', '(', 'XlibSelectDevice', ',', 'Device', ')', ':', '___EOS___']", "index": 286 }, { "content": " def select(self):\n if not self._fileno:\n return\n\n events = (input_event * 64)()\n bytes = c.read(self._fileno, events, ctypes.sizeof(events))\n if bytes < 0:\n return\n\n n_events = bytes // ctypes.sizeof(input_event)\n for event in events[:n_events]:\n try:\n control = self.control_map[(event.type, event.code)]\n control._set_value(event.value)\n except KeyError:\n pass", "metadata": "root.EvdevDevice.select", "header": "['class', 'EvdevDevice', '(', 'XlibSelectDevice', ',', 'Device', ')', ':', '___EOS___']", "index": 290 }, { "content": "def get_devices(display=None):\n base = '/dev/input'\n for filename in os.listdir(base):\n if filename.startswith('event'):\n path = os.path.join(base, filename)\n if path in _devices:\n continue\n\n try:\n _devices[path] = EvdevDevice(display, path)\n except OSError:\n pass \n\n return _devices.values()", "metadata": "root.get_devices", "header": "['module', '___EOS___']", "index": 308 }, { "content": "def get_joysticks(display=None):\n return filter(None, [_create_joystick(d) for d in get_devices(display)])", "metadata": "root.get_joysticks", "header": "['module', '___EOS___']", "index": 323 } ]
[ { "span": "from base import Device, Control, RelativeAxis, AbsoluteAxis, Button, Joystick", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 78 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "docformat", "\\u\\u_", "=_", "'", "restructur", "edt", "ext", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "version\\u\\u_", "=_", "'$", "Id", "$'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "ctypes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "errno_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "pyglet_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyglet_", "._", "app_", "._", "xli", "b_", "import_", "Xl", "ib", "Select", "Device_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "base_", "import_", "Device_", ",_", "Control_", ",_", "Relative", "Axis_", ",_", "Abs", "olute", "Axis_", ",_", "Button_", ",_", "Joy", "stick", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "base_", "import_", "Dev", "ice", "Open", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ev", "dev", "\\u", "constants_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ev", "dev", "\\u", "constants_", "import_", "\\u", "rel", "\\u", "raw", "\\u", "names_", ",_", "\\u", "abs", "\\u", "raw", "\\u", "names_", ",_", "\\u", "key", "\\u", "raw", "\\u", "names_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "=_", "pyglet_", "._", "lib_", "._", "load", "\\u", "library_", "(_", "'", "c", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "IOC", "\\u", "NR", "BITS_", "=_", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "IOC", "\\u", "TYPE", "BITS_", "=_", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "IOC", "\\u", "SIZE", "BITS_", "=_", "14_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "IOC", "\\u", "DIR", "BITS_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "IOC", "\\u", "NR", "MASK_", "=_", "(_", "(_", "1_", "<<_", "\\u", "IOC", "\\u", "NR", "BITS_", ")_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "IOC", "\\u", "TYPE", "MASK_", "=_", "(_", "(_", "1_", "<<_", "\\u", "IOC", "\\u", "TYPE", "BITS_", ")_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "IOC", "\\u", "SIZE", "MASK_", "=_", "(_", "(_", "1_", "<<_", "\\u", "IOC", "\\u", "SIZE", "BITS_", ")_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "IOC", "\\u", "DIR", "MASK_", "=_", "(_", "(_", "1_", "<<_", "\\u", "IOC", "\\u", "DIR", "BITS_", ")_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "IOC", "\\u", "NR", "SHIFT_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "IOC", "\\u", "TYPES", "HIFT", "_", "=_", "(_", "\\u", "IOC", "\\u", "NR", "SHIFT_", "+_", "\\u", "IOC", "\\u", "NR", "BITS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "IOC", "\\u", "SIZE", "SHIFT_", "=_", "(_", "\\u", "IOC", "\\u", "TYPES", "HIFT", "_", "+_", "\\u", "IOC", "\\u", "TYPE", "BITS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "IOC", "\\u", "DIR", "SHIFT_", "=_", "(_", "\\u", "IOC", "\\u", "SIZE", "SHIFT_", "+_", "\\u", "IOC", "\\u", "SIZE", "BITS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "IOC", "\\u", "NONE_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "IOC", "\\u", "WRITE_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "IOC", "\\u", "READ_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "time", "\\u", "t_", "=_", "ctypes_", "._", "c\\u", "long_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sus", "econd", "s", "\\u", "t_", "=_", "ctypes_", "._", "c\\u", "long_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "EV", "IOC", "GV", "ERS", "ION_", "=_", "\\u", "IO", "R_", "(_", "'", "E", "'_", ",_", "0x01_", ",_", "ctypes_", "._", "c\\u", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EV", "IOC", "GID", "_", "=_", "\\u", "IO", "R_", "(_", "'", "E", "'_", ",_", "0x02_", ",_", "input", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EV", "IOC", "GN", "AME_", "=_", "\\u", "IO", "R", "\\u", "str_", "(_", "'", "E", "'_", ",_", "0x06_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EV", "IOC", "GP", "HY", "S_", "=_", "\\u", "IO", "R", "\\u", "str_", "(_", "'", "E", "'_", ",_", "0x07_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EV", "IOC", "GU", "NI", "Q_", "=_", "\\u", "IO", "R", "\\u", "str_", "(_", "'", "E", "'_", ",_", "0x08_", ")_", "\\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", "abs", "\\u", "names_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "ABS", "\\u", "X_", ":_", "Abs", "olute", "Axis_", "._", "X_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ABS", "\\u", "Y_", ":_", "Abs", "olute", "Axis_", "._", "Y_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ABS", "\\u", "Z_", ":_", "Abs", "olute", "Axis_", "._", "Z_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ABS", "\\u", "RX", "_", ":_", "Abs", "olute", "Axis_", "._", "RX", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ABS", "\\u", "RY_", ":_", "Abs", "olute", "Axis_", "._", "RY_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ABS", "\\u", "RZ", "_", ":_", "Abs", "olute", "Axis_", "._", "RZ", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ABS", "\\u", "HAT", "0X", "_", ":_", "Abs", "olute", "Axis_", "._", "HAT", "\\u", "X_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ABS", "\\u", "HAT", "0", "Y_", ":_", "Abs", "olute", "Axis_", "._", "HAT", "\\u", "Y_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "rel", "\\u", "names_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "REL", "\\u", "X_", ":_", "Relative", "Axis_", "._", "X_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "REL", "\\u", "Y_", ":_", "Relative", "Axis_", "._", "Y_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "REL", "\\u", "Z_", ":_", "Relative", "Axis_", "._", "Z_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "REL", "\\u", "RX", "_", ":_", "Relative", "Axis_", "._", "RX", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "REL", "\\u", "RY_", ":_", "Relative", "Axis_", "._", "RY_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "REL", "\\u", "RZ", "_", ":_", "Relative", "Axis_", "._", "RZ", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "REL", "\\u", "WHE", "EL_", ":_", "Relative", "Axis_", "._", "WHE", "EL_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\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_", "event", "\\u", "types_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "EV", "\\u", "KEY_", ":_", "KEY", "\\u", "MAX_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "EV", "\\u", "REL", "_", ":_", "REL", "\\u", "MAX_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "EV", "\\u", "ABS", "_", ":_", "ABS", "\\u", "MAX_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "EV", "\\u", "MS", "C_", ":_", "MS", "C", "\\u", "MAX_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "EV", "\\u", "LED", "_", ":_", "LED", "\\u", "MAX_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "EV", "\\u", "SN", "D_", ":_", "SN", "D", "\\u", "MAX_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "devices_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\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_", "\\u", "IOC", "_", "(_", "dir_", ",_", "type_", ",_", "nr_", ",_", "size_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "(_", "dir_", "<<_", "\\u", "IOC", "\\u", "DIR", "SHIFT_", ")_", "|_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "type_", "<<_", "\\u", "IOC", "\\u", "TYPES", "HIFT", "_", ")_", "|_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "nr_", "<<_", "\\u", "IOC", "\\u", "NR", "SHIFT_", ")_", "|_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "size_", "<<_", "\\u", "IOC", "\\u", "SIZE", "SHIFT_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "IO", "R_", "(_", "type_", ",_", "nr_", ",_", "struct_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "\\u", "IOC", "_", "(_", "\\u", "IOC", "\\u", "READ_", ",_", "ord_", "(_", "type_", ")_", ",_", "nr_", ",_", "ctypes_", "._", "sizeof_", "(_", "struct_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "f_", "(_", "fileno_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "buffer_", "=_", "struct_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "c_", "._", "ioct", "l_", "(_", "fileno_", ",_", "request_", ",_", "ctypes_", "._", "byref_", "(_", "buffer_", ")_", ")_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err_", "=_", "ctypes_", "._", "c\\u", "int_", "._", "in", "\\u", "dll_", "(_", "c_", ",_", "'", "errno", "'_", ")_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "OSE", "rror_", "(_", "err_", ",_", "errno_", "._", "errorcode", "_", "[_", "err_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "buffer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "IO", "R", "\\u", "len_", "(_", "type_", ",_", "nr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "f_", "(_", "fileno_", ",_", "buffer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "\\u", "IOC", "_", "(_", "\\u", "IOC", "\\u", "READ_", ",_", "ord_", "(_", "type_", ")_", ",_", "nr_", ",_", "ctypes_", "._", "sizeof_", "(_", "buffer_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "c_", "._", "ioct", "l_", "(_", "fileno_", ",_", "request_", ",_", "ctypes_", "._", "byref_", "(_", "buffer_", ")_", ")_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err_", "=_", "ctypes_", "._", "c\\u", "int_", "._", "in", "\\u", "dll_", "(_", "c_", ",_", "'", "errno", "'_", ")_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "OSE", "rror_", "(_", "err_", ",_", "errno_", "._", "errorcode", "_", "[_", "err_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "buffer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "IO", "R", "\\u", "str_", "(_", "type_", ",_", "nr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "g_", "=_", "\\u", "IO", "R", "\\u", "len_", "(_", "type_", ",_", "nr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "f_", "(_", "fileno_", ",_", "len_", "=_", "256_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "g_", "(_", "fileno_", ",_", "ctypes_", "._", "create", "\\u", "string", "\\u", "buffer_", "(_", "len_", ")_", ")_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "time", "val_", "(_", "ctypes_", "._", "Structure_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "fields\\u_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "tv", "\\u", "sec", "'_", ",_", "time", "\\u", "t_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "tv", "\\u", "usec", "'_", ",_", "sus", "econd", "s", "\\u", "t_", ")_", "\\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_", "input", "\\u", "event_", "(_", "ctypes_", "._", "Structure_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "fields\\u_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "time", "'_", ",_", "time", "val_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "type", "'_", ",_", "ctypes_", "._", "c\\u", "uint16_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "code", "'_", ",_", "ctypes_", "._", "c\\u", "uint16_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "value", "'_", ",_", "ctypes_", "._", "c\\u", "int32_", ")_", "\\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_", "input", "\\u", "id_", "(_", "ctypes_", "._", "Structure_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "fields\\u_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "bust", "ype", "'_", ",_", "ctypes_", "._", "c\\u", "uint16_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "vendor", "'_", ",_", "ctypes_", "._", "c\\u", "uint16_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "product", "'_", ",_", "ctypes_", "._", "c\\u", "uint16_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "version", "'_", ",_", "ctypes_", "._", "c\\u", "uint16_", ")_", ",_", "\\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_", "input", "\\u", "abs", "info_", "(_", "ctypes_", "._", "Structure_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "fields\\u_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "value", "'_", ",_", "ctypes_", "._", "c\\u", "int32_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "minim", "um", "'_", ",_", "ctypes_", "._", "c\\u", "int32_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "maxim", "um", "'_", ",_", "ctypes_", "._", "c\\u", "int32_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "fuzz", "'_", ",_", "ctypes_", "._", "c\\u", "int32_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "flat", "'_", ",_", "ctypes_", "._", "c\\u", "int32_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "EV", "IOC", "GB", "IT", "_", "(_", "fileno_", ",_", "ev_", ",_", "buffer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "IO", "R", "\\u", "len_", "(_", "'", "E", "'_", ",_", "0x20_", "+_", "ev_", ")_", "(_", "fileno_", ",_", "buffer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "EV", "IOC", "GA", "BS", "_", "(_", "fileno_", ",_", "abs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "buffer_", "=_", "input", "\\u", "abs", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u", "IO", "R", "\\u", "len_", "(_", "'", "E", "'_", ",_", "0x40_", "+_", "abs_", ")_", "(_", "fileno_", ",_", "buffer_", ")_", "\\u\\u\\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", "set\\u", "bits_", "(_", "bytes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bits_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "byte_", "in_", "bytes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "range_", "(_", "8_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "byte_", "&_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bits_", "._", "add_", "(_", "j_", "+_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "byte_", ">>", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "j_", "+=_", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "bits_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "create", "\\u", "control_", "(_", "fileno_", ",_", "event", "\\u", "type_", ",_", "event", "\\u", "code_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "event", "\\u", "type_", "==_", "EV", "\\u", "ABS", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raw", "\\u", "name_", "=_", "\\u", "abs", "\\u", "raw", "\\u", "names_", "._", "get_", "(_", "event", "\\u", "code_", ",_", "'", "EV", "\\u", "ABS", "(%", "x", ")'_", "%_", "event", "\\u", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "\\u", "abs", "\\u", "names_", "._", "get_", "(_", "event", "\\u", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "abs", "info_", "=_", "EV", "IOC", "GA", "BS", "_", "(_", "fileno_", ",_", "event", "\\u", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "abs", "info_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min_", "=_", "abs", "info_", "._", "minimum_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max_", "=_", "abs", "info_", "._", "maximum_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "control_", "=_", "Abs", "olute", "Axis_", "(_", "name_", ",_", "min_", ",_", "max_", ",_", "raw", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "control_", "._", "\\u", "set\\u", "value_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "name_", "==_", "'", "hat", "\\u", "y", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "control_", "._", "inverted", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "event", "\\u", "type_", "==_", "EV", "\\u", "REL", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raw", "\\u", "name_", "=_", "\\u", "rel", "\\u", "raw", "\\u", "names_", "._", "get_", "(_", "event", "\\u", "code_", ",_", "'", "EV", "\\u", "REL", "(%", "x", ")'_", "%_", "event", "\\u", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "\\u", "rel", "\\u", "names_", "._", "get_", "(_", "event", "\\u", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", " ", "min", "/", "max", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "control_", "=_", "Relative", "Axis_", "(_", "name_", ",_", "raw", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "event", "\\u", "type_", "==_", "EV", "\\u", "KEY_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raw", "\\u", "name_", "=_", "\\u", "key", "\\u", "raw", "\\u", "names_", "._", "get_", "(_", "event", "\\u", "code_", ",_", "'", "EV", "\\u", "KEY", "(%", "x", ")'_", "%_", "event", "\\u", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "control_", "=_", "Button_", "(_", "name_", ",_", "raw", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "min_", "=_", "max_", "=_", "0_", "#", " ", "TOD", "O_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "control_", "._", "\\u", "event", "\\u", "type_", "=_", "event", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "control_", "._", "\\u", "event", "\\u", "code_", "=_", "event", "\\u", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "control_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "create", "\\u", "joystick", "_", "(_", "device_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Look", " ", "for", " ", "somet", "hing", " ", "with", " ", "an", " ", "ABS", " ", "X", " ", "and", " ", "ABS", " ", "Y", " ", "axis", ",", " ", "and", " ", "a", " ", "joystick", " ", "0", " ", "button_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "have", "\\u", "x_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "have", "\\u", "y_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "have", "\\u", "button_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "control_", "in_", "device_", "._", "controls_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "control_", "._", "\\u", "event", "\\u", "type_", "==_", "EV", "\\u", "ABS", "_", "and_", "control_", "._", "\\u", "event", "\\u", "code_", "==_", "ABS", "\\u", "X_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "have", "\\u", "x_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "control_", "._", "\\u", "event", "\\u", "type_", "==_", "EV", "\\u", "ABS", "_", "and_", "control_", "._", "\\u", "event", "\\u", "code_", "==_", "ABS", "\\u", "Y_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "have", "\\u", "y_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "control_", "._", "\\u", "event", "\\u", "type_", "==_", "EV", "\\u", "KEY_", "and_", "control_", "._", "\\u", "event", "\\u", "code_", "==_", "BTN", "\\u", "JO", "YST", "IC", "K_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "have", "\\u", "button_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "(_", "have", "\\u", "x_", "and_", "have", "\\u", "y_", "and_", "have", "\\u", "button_", ")_", ":_", "\\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_", "return_", "Joy", "stick", "_", "(_", "device_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Ev", "dev", "Device_", "(_", "Xl", "ib", "Select", "Device_", ",_", "Device_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "fileno_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Xl", "ib", "Select", "Dev", "ice", " ", "interface_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Ev", "dev", "Device_", "(_", "Xl", "ib", "Select", "Device_", ",_", "Device_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "display_", ",_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "filename_", "=_", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fileno_", "=_", "os_", "._", "open_", "(_", "filename_", ",_", "os_", "._", "O", "\\u", "RD", "ONLY_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "event", "\\u", "version", " ", "=", " ", "EV", "IOC", "GV", "ERS", "ION", "(", "filen", "o", ").", "value_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "id_", "=_", "EV", "IOC", "GID", "_", "(_", "fileno_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "id", "\\u", "bust", "ype_", "=_", "id_", "._", "bust", "ype_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "id", "\\u", "vendor_", "=_", "hex_", "(_", "id_", "._", "vendor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "id", "\\u", "product_", "=_", "hex_", "(_", "id_", "._", "product_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "id", "\\u", "version_", "=_", "id_", "._", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "EV", "IOC", "GN", "AME_", "(_", "fileno_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "name_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Unic", "ode", "Decode", "Error_", ":_", "\\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 ", " _", "name_", "=_", "name_", "._", "decode_", "(_", "'", "latin", "-1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Unic", "ode", "Decode", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "phys", "_", "=_", "EV", "IOC", "GP", "HY", "S_", "(_", "fileno_", ")_", "\\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 ", " _", "self_", "._", "phys", "_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "uniq", "_", "=_", "EV", "IOC", "GU", "NI", "Q_", "(_", "fileno_", ")_", "\\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 ", " _", "self_", "._", "uniq", "_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "controls_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "control", "\\u", "map_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "event", "\\u", "types", "\\u", "bits_", "=_", "(_", "ctypes_", "._", "c\\u", "byte_", "*_", "4_", ")_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EV", "IOC", "GB", "IT", "_", "(_", "fileno_", ",_", "0_", ",_", "event", "\\u", "types", "\\u", "bits_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "event", "\\u", "type_", "in_", "get", "\\u", "set\\u", "bits_", "(_", "event", "\\u", "types", "\\u", "bits_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "event", "\\u", "type_", "not_", "in_", "event", "\\u", "types_", ":_", "\\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_", "max", "\\u", "code_", "=_", "event", "\\u", "types_", "[_", "event", "\\u", "type_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nbytes_", "=_", "max", "\\u", "code_", "//_", "8_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event", "\\u", "codes", "\\u", "bits_", "=_", "(_", "ctypes_", "._", "c\\u", "byte_", "*_", "nbytes_", ")_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EV", "IOC", "GB", "IT", "_", "(_", "fileno_", ",_", "event", "\\u", "type_", ",_", "event", "\\u", "codes", "\\u", "bits_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "event", "\\u", "code_", "in_", "get", "\\u", "set\\u", "bits_", "(_", "event", "\\u", "codes", "\\u", "bits_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "control_", "=_", "\\u", "create", "\\u", "control_", "(_", "fileno_", ",_", "event", "\\u", "type_", ",_", "event", "\\u", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "control_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "control", "\\u", "map_", "[_", "(_", "event", "\\u", "type_", ",_", "event", "\\u", "code_", ")_", "]_", "=_", "control_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "controls_", "._", "append_", "(_", "control_", ")_", "\\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_", "os_", "._", "close_", "(_", "fileno_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "super_", "(_", "Ev", "dev", "Device_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "display_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ev", "dev", "Device_", "(_", "Xl", "ib", "Select", "Device_", ",_", "Device_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "open_", "(_", "self_", ",_", "window_", "=_", "None_", ",_", "exclusive_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Ev", "dev", "Device_", ",_", "self_", ")_", "._", "open_", "(_", "window_", ",_", "exclusive_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "fileno_", "=_", "os_", "._", "open_", "(_", "self_", "._", "\\u", "filename_", ",_", "os_", "._", "O", "\\u", "RD", "ONLY_", "|_", "os_", "._", "O", "\\u", "NON", "BLOCK_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Dev", "ice", "Open", "Exception_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pyglet_", "._", "app_", "._", "platform", "\\u", "event", "\\u", "loop_", "._", "\\u", "select", "\\u", "devices_", "._", "add_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ev", "dev", "Device_", "(_", "Xl", "ib", "Select", "Device_", ",_", "Device_", ")_", ":_", "\\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 ", " _", "super_", "(_", "Ev", "dev", "Device_", ",_", "self_", ")_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "self_", "._", "\\u", "fileno_", ":_", "\\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_", "pyglet_", "._", "app_", "._", "platform", "\\u", "event", "\\u", "loop_", "._", "\\u", "select", "\\u", "devices_", "._", "remove_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "close_", "(_", "self_", "._", "\\u", "fileno_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "fileno_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ev", "dev", "Device_", "(_", "Xl", "ib", "Select", "Device_", ",_", "Device_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "controls_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "controls_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ev", "dev", "Device_", "(_", "Xl", "ib", "Select", "Device_", ",_", "Device_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "fileno_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "fileno_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ev", "dev", "Device_", "(_", "Xl", "ib", "Select", "Device_", ",_", "Device_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "poll_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ev", "dev", "Device_", "(_", "Xl", "ib", "Select", "Device_", ",_", "Device_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "select_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "\\u", "fileno_", ":_", "\\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_", "events_", "=_", "(_", "input", "\\u", "event_", "*_", "64_", ")_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bytes_", "=_", "c_", "._", "read_", "(_", "self_", "._", "\\u", "fileno_", ",_", "events_", ",_", "ctypes_", "._", "sizeof_", "(_", "events_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "bytes_", "<_", "0_", ":_", "\\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_", "n", "\\u", "events_", "=_", "bytes_", "//_", "ctypes_", "._", "sizeof_", "(_", "input", "\\u", "event_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "event_", "in_", "events_", "[_", ":_", "n", "\\u", "events_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "control_", "=_", "self_", "._", "control", "\\u", "map_", "[_", "(_", "event_", "._", "type_", ",_", "event_", "._", "code_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "control_", "._", "\\u", "set\\u", "value_", "(_", "event_", "._", "value_", ")_", "\\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 ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "devices_", "(_", "display_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "base_", "=_", "'/", "dev", "/", "input", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "filename_", "in_", "os_", "._", "listdir_", "(_", "base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "filename_", "._", "startswith_", "(_", "'", "event", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "base_", ",_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "path_", "in_", "\\u", "devices_", ":_", "\\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 ", " _", "\\u", "devices_", "[_", "path_", "]_", "=_", "Ev", "dev", "Device_", "(_", "display_", ",_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u", "devices_", "._", "values_", "(_", ")_", "\\u\\u\\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", "joystick", "s_", "(_", "display_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "filter_", "(_", "None_", ",_", "[_", "\\u", "create", "\\u", "joystick", "_", "(_", "d_", ")_", "for_", "d_", "in_", "get", "\\u", "devices_", "(_", "display_", ")_", "]_", ")_" ]
[ 4, 4, 4, 4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{ "content": " def do_HEAD(s):\n \"\"\"\n Respond to an image HEAD request fake metadata\n \"\"\"\n if 'images' in s.path:\n s.send_response(200)\n s.send_header('Content-Type', 'application/octet-stream')\n s.send_header('Content-Length', FIVE_KB)\n s.end_headers()\n return\n else:\n self.send_error(404, 'File Not Found: %s' % self.path)\n return", "metadata": "root.RemoteImageHandler.do_HEAD", "header": "['class', 'RemoteImageHandler', '(', 'BaseHTTPServer', '.', 'BaseHTTPRequestHandler', ')', ':', '___EOS___']", "index": 44 }, { "content": " def do_GET(s):\n \"\"\"\n Respond to an image GET request with fake image content.\n \"\"\"\n if 'images' in s.path:\n s.send_response(200)\n s.send_header('Content-Type', 'application/octet-stream')\n s.send_header('Content-Length', FIVE_KB)\n s.end_headers()\n image_data = '*' * FIVE_KB\n s.wfile.write(image_data)\n self.wfile.close()\n return\n else:\n self.send_error(404, 'File Not Found: %s' % self.path)\n return", "metadata": "root.RemoteImageHandler.do_GET", "header": "['class', 'RemoteImageHandler', '(', 'BaseHTTPServer', '.', 'BaseHTTPRequestHandler', ')', ':', '___EOS___']", "index": 58 } ]
[ { "span": "def do_HEAD(s):", "start_line": 44, "start_column": 4, "end_line": 44, "end_column": 19 }, { "span": "def do_GET(s):", "start_line": 58, "start_column": 4, "end_line": 58, "end_column": 18 } ]
[]
1
true
[ "[CLS]_", "First_", "parameter_", "of_", "a_", "method_", "is_", "not_", "named_", "'", "self", "'_", "[SEP]_", "class_", "Remo", "te", "Image", "Handler_", "(_", "Base", "HTTP", "Server_", "._", "Base", "HTTP", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "do", "\\u", "HEAD_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Respo", "nd", " ", "to", " ", "an", " ", "image", " ", "HEAD", " ", "request", " ", "fake", " ", "metadata", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "images", "'_", "in_", "s_", "._", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "._", "send", "\\u", "response_", "(_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "send", "\\u", "header_", "(_", "'", "Conten", "t", "-", "Type", "'_", ",_", "'", "applica", "tion", "/", "oct", "et", "-", "stream", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "send", "\\u", "header_", "(_", "'", "Conten", "t", "-", "Length", "'_", ",_", "FI", "VE", "\\u", "KB", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "end", "\\u", "headers_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "send", "\\u", "error_", "(_", "404_", ",_", "'", "File", " ", "Not", " ", "Foun", "d", ":", " ", "%", "s", "'_", "%_", "self_", "._", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Remo", "te", "Image", "Handler_", "(_", "Base", "HTTP", "Server_", "._", "Base", "HTTP", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "GET_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Respo", "nd", " ", "to", " ", "an", " ", "image", " ", "GET", " ", "request", " ", "with", " ", "fake", " ", "image", " ", "content", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "images", "'_", "in_", "s_", "._", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "._", "send", "\\u", "response_", "(_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "send", "\\u", "header_", "(_", "'", "Conten", "t", "-", "Type", "'_", ",_", "'", "applica", "tion", "/", "oct", "et", "-", "stream", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "send", "\\u", "header_", "(_", "'", "Conten", "t", "-", "Length", "'_", ",_", "FI", "VE", "\\u", "KB", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "end", "\\u", "headers_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image", "\\u", "data_", "=_", "'*'_", "*_", "FI", "VE", "\\u", "KB", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "wfile_", "._", "write_", "(_", "image", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wfile_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "send", "\\u", "error_", "(_", "404_", ",_", "'", "File", " ", "Not", " ", "Foun", "d", ":", " ", "%", "s", "'_", "%_", "self_", "._", "path_", ")_", "\\u\\u\\uNEWLINE\\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 ]
Unused import
kleientertainment/ds_mod_tools/pkg/win32/mod_tools/exported/export.py
[ { "content": "import sys, os, argparse, glob\nimport xml.etree.ElementTree as ET\nimport ResizeInfo, ExportOptions\nfrom klei import util\nimport subprocess\n\nSCRIPT_DIR = os.path.dirname( __file__ )\n\nsys.path.append( SCRIPT_DIR )\n\n\n\n \n\n\nif __name__ == \"__main__\":\n CWD = os.getcwd()\n\n # Now do the export\n parser = argparse.ArgumentParser( description = \"Animation batch exporter script\" )\n parser.add_argument( '--platform', default='opengl' )\n parser.add_argument( '--textureformat', default='bc3' )\n parser.add_argument( '--hardalphatextureformat', default='bc1' )\n parser.add_argument( '--force', action='store_true' )\n parser.add_argument( '--square', action='store_true' )\n parser.add_argument( '--ignoreexceptions', action='store_true' )\n parser.add_argument( 'anims', type=str, nargs='?', help=\"List of anim filenames to be exported\" )\n parser.add_argument( '--outputdir', default='data' )\n parser.add_argument( '--prefabsdir', default='' )\n parser.add_argument( '--skip_update_prefabs', action='store_true' )\n args = parser.parse_args()\n\n if len( args.prefabsdir ) == 0:\n args.prefabsdir = os.path.join( SCRIPT_DIR, \"..\", args.outputdir )\n\n prefabs_file = os.path.abspath( os.path.normpath( os.path.join( CWD, args.prefabsdir, \"prefabs.xml\" ) ) )\n prefabs = Prefabs( prefabs_file )\n anims = []\n if args.anims:\n anims = [ args.anims ]\n else:\n anims = [ os.path.basename( anim.File ) for anim in prefabs.GetAssetType( \"anim\" ) ]\n\n # sorted, unique anims\n anims = sorted( set( anims ) )\n anims = [ ( anim, prefabs, args ) for anim in anims ]\n\n from multiprocessing import Pool\n pool = Pool(processes=1)\n pool.map( ConvertAnim, anims )\n\n # Ensure that the prefabs.xml file is up to date\n if not args.skip_update_prefabs:\n os.chdir( os.path.join( SCRIPT_DIR, \"..\" ) )\n os.system( ' '.join( ( 'updateprefabs.bat', args.outputdir ) ) )\n\n os.chdir( CWD )\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Asset:", "metadata": "root.Asset", "header": "['module', '___EOS___']", "index": 10 }, { "content": " def __init__( self, filename, asset_type ):\n self.File = filename\n self.Type = asset_type", "metadata": "root.Asset.__init__", "header": "['class', 'Asset', ':', '___EOS___']", "index": 11 }, { "content": "class Prefab:", "metadata": "root.Prefab", "header": "['module', '___EOS___']", "index": 15 }, { "content": " def __init__( self, name, assets = [] ):\n self.Name = name\n self.Assets = assets", "metadata": "root.Prefab.__init__", "header": "['class', 'Prefab', ':', '___EOS___']", "index": 16 }, { "content": "class Prefabs:\n\n\n", "metadata": "root.Prefabs", "header": "['module', '___EOS___']", "index": 20 }, { "content": " def __init__( self, filename ):\n self.Prefabs = self.ParsePrefabs( filename )", "metadata": "root.Prefabs.__init__", "header": "['class', 'Prefabs', ':', '___EOS___']", "index": 21 }, { "content": " def GetAssetType( self, asset_type ):\n asset_type = asset_type.upper()\n assets = []\n \n for prefab in self.Prefabs:\n for asset in prefab.Assets:\n if asset.Type == asset_type:\n assets.append( asset )\n\n return assets", "metadata": "root.Prefabs.GetAssetType", "header": "['class', 'Prefabs', ':', '___EOS___']", "index": 24 }, { "content": " def ParsePrefabs( self, filename ):\n tree = ET.parse( filename )\n prefabs = tree.findall( \"Defs/Prefab\" )\n\n prefab_list = []\n for prefab in prefabs:\n name = prefab.attrib[ 'name' ]\n assets = [ Asset( asset.attrib[ 'file' ], asset.attrib[ 'type' ].upper() ) for asset in prefab.findall( \"Assets/Asset\" ) ]\n prefab_list.append( Prefab( name, assets ) )\n\n return prefab_list", "metadata": "root.Prefabs.ParsePrefabs", "header": "['class', 'Prefabs', ':', '___EOS___']", "index": 35 }, { "content": " def GetOwner( self, asset_filename ):\n for prefab in self.Prefabs:\n for asset in prefab.Assets:\n if os.path.basename( asset.File ) == asset_filename:\n return prefab\n return None", "metadata": "root.Prefabs.GetOwner", "header": "['class', 'Prefabs', ':', '___EOS___']", "index": 47 }, { "content": "def ConvertAnim(params):\n anim, prefabs, args = params\n anim_path = anim\n\n anim = os.path.basename(anim.strip())\n prefab_owner = prefabs.GetOwner( anim )\n scale = ResizeInfo.DefaultSize()\n if prefab_owner:\n scale = ResizeInfo.SizeMap[ prefab_owner.Name ]\n #print (prefab_owner.Name, scale)\n\n # Filename scaling overrides general prefab settings\n anim_filename = os.path.basename( anim )\n anim_name, ext = os.path.splitext( anim_filename )\n keys_to_try = [ anim, anim_filename, anim_name ]\n for key in keys_to_try:\n scale = ResizeInfo.SizeMap.get( key, scale )\n\n additional_options = ExportOptions.Options.get( anim_name, [] )\n cmd_args = [\n os.path.join( SCRIPT_DIR, r\"..\\buildtools\\windows\\python27\\python.exe\" ),\n os.path.join( SCRIPT_DIR, r\"..\\tools\\scripts\\buildanimation.py\" ),\n \"--scale=\" + str( scale )\n ]\n \n additional_args = ( 'platform', 'textureformat', 'hardalphatextureformat' )\n for arg in additional_args:\n try:\n val = getattr( args, arg )\n cmd_args.append( '--{}={}'.format( arg, val ) )\n except:\n pass\n\n additional_flags = ( 'force', 'square', 'ignoreexceptions' )\n for flag in additional_flags:\n try:\n val = getattr( args, flag )\n if val:\n cmd_args.append( '--' + flag )\n except:\n pass\n\n os.chdir( SCRIPT_DIR )\n\n src_file = anim_path \n anim_dir = os.path.normpath( os.path.join(\"..\", args.outputdir, \"anim\"))\n if not os.path.exists(anim_dir):\n os.makedirs(anim_dir)\n dest_file = os.path.join(anim_dir, anim)\n\n if args.force or util.IsFileNewer( src_file, dest_file ):\n cmd_args += additional_options\n cmd_args.append( src_file )\n cmd_args.append( '--outputdir=' + args.outputdir )\n\n print( '\\tExporting ' + anim )\n return subprocess.call(cmd_args)\n else:\n return 0", "metadata": "root.ConvertAnim", "header": "['module', '___EOS___']", "index": 55 } ]
[ { "span": "import sys, os, argparse, glob", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 30 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "sys_", ",_", "os_", ",_", "argparse_", ",_", "glob_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "xml_", "._", "etree_", "._", "Element", "Tree_", "as_", "ET_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Resize", "Info_", ",_", "Export", "Options_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kle", "i_", "import_", "util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "SCRIPT", "\\u", "DIR_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sys_", "._", "path_", "._", "append_", "(_", "SCRIPT", "\\u", "DIR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "CW", "D_", "=_", "os_", "._", "getcwd_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "do", " ", "the", " ", "export_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "=_", "argparse_", "._", "Arg", "ument", "Parser_", "(_", "description_", "=_", "\"", "Animat", "ion", " ", "batch", " ", "exporter", " ", "script", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "platform", "'_", ",_", "default_", "=_", "'", "opengl", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "textu", "reformat", "'_", ",_", "default_", "=_", "'", "bc", "3", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "hard", "alpha", "textu", "reformat", "'_", ",_", "default_", "=_", "'", "bc", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "force", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "square", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "ignore", "exception", "s", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'", "anim", "s", "'_", ",_", "type_", "=_", "str_", ",_", "nargs_", "=_", "'?'_", ",_", "help_", "=_", "\"", "List", " ", "of", " ", "anim", " ", "filename", "s", " ", "to", " ", "be", " ", "exported", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "output", "dir", "'_", ",_", "default_", "=_", "'", "data", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "prefa", "bsd", "ir", "'_", ",_", "default_", "=_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "skip", "\\u", "update", "\\u", "prefa", "bs", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "parser_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "args_", "._", "prefa", "bsd", "ir_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "._", "prefa", "bsd", "ir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "SCRIPT", "\\u", "DIR_", ",_", "\"..\"_", ",_", "args_", "._", "outputdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "prefa", "bs", "\\u", "file_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "os_", "._", "path_", "._", "normpath_", "(_", "os_", "._", "path_", "._", "join_", "(_", "CW", "D_", ",_", "args_", "._", "prefa", "bsd", "ir_", ",_", "\"", "prefa", "bs", ".", "xml", "\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prefa", "bs_", "=_", "Pref", "abs_", "(_", "prefa", "bs", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "anim", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "args_", "._", "anim", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "anim", "s_", "=_", "[_", "args_", "._", "anim", "s_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "anim", "s_", "=_", "[_", "os_", "._", "path_", "._", "basename_", "(_", "anim_", "._", "File_", ")_", "for_", "anim_", "in_", "prefa", "bs_", "._", "Get", "Asset", "Type_", "(_", "\"", "anim", "\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sorte", "d", ",", " ", "unique", " ", "anim", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "anim", "s_", "=_", "sorted_", "(_", "set_", "(_", "anim", "s_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "anim", "s_", "=_", "[_", "(_", "anim_", ",_", "prefa", "bs_", ",_", "args_", ")_", "for_", "anim_", "in_", "anim", "s_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "multiprocessing_", "import_", "Pool_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pool_", "=_", "Pool_", "(_", "processes_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pool_", "._", "map_", "(_", "Convert", "Anim", "_", ",_", "anim", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ensur", "e", " ", "tha", "t", " ", "the", " ", "prefa", "bs", ".", "xml", " ", "file", " ", "is", " ", "up", " ", "to", " ", "date_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "args_", "._", "skip", "\\u", "update", "\\u", "prefa", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "chdir_", "(_", "os_", "._", "path_", "._", "join_", "(_", "SCRIPT", "\\u", "DIR_", ",_", "\"..\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "system_", "(_", "'", " ", "'_", "._", "join_", "(_", "(_", "'", "update", "prefa", "bs", ".", "bat", "'_", ",_", "args_", "._", "outputdir_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "chdir_", "(_", "CW", "D_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Asset_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asset_", ":_", "\\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_", ",_", "filename_", ",_", "asset", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "File_", "=_", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Type_", "=_", "asset", "\\u", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Pref", "ab_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pref", "ab_", ":_", "\\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_", ",_", "name_", ",_", "assets_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Name_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Asset", "s_", "=_", "assets_", "\\u\\u\\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_", "Pref", "abs_", ":_", "\\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_", "Pref", "abs_", ":_", "\\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_", ",_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Pref", "abs_", "=_", "self_", "._", "Pars", "e", "Pref", "abs_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pref", "abs_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Get", "Asset", "Type_", "(_", "self_", ",_", "asset", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "asset", "\\u", "type_", "=_", "asset", "\\u", "type_", "._", "upper_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assets_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "prefa", "b_", "in_", "self_", "._", "Pref", "abs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "asset_", "in_", "prefa", "b_", "._", "Asset", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "asset_", "._", "Type_", "==_", "asset", "\\u", "type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "assets_", "._", "append_", "(_", "asset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "assets_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pref", "abs_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Pars", "e", "Pref", "abs_", "(_", "self_", ",_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tree_", "=_", "ET_", "._", "parse_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prefa", "bs_", "=_", "tree_", "._", "findall_", "(_", "\"", "Defs", "/", "Pref", "ab", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "prefa", "b", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "prefa", "b_", "in_", "prefa", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "prefa", "b_", "._", "attrib_", "[_", "'", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assets_", "=_", "[_", "Asset_", "(_", "asset_", "._", "attrib_", "[_", "'", "file", "'_", "]_", ",_", "asset_", "._", "attrib_", "[_", "'", "type", "'_", "]_", "._", "upper_", "(_", ")_", ")_", "for_", "asset_", "in_", "prefa", "b_", "._", "findall_", "(_", "\"", "Asset", "s", "/", "Asset", "\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prefa", "b", "\\u", "list_", "._", "append_", "(_", "Pref", "ab_", "(_", "name_", ",_", "assets_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "prefa", "b", "\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pref", "abs_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Get", "Owner_", "(_", "self_", ",_", "asset", "\\u", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "prefa", "b_", "in_", "self_", "._", "Pref", "abs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "asset_", "in_", "prefa", "b_", "._", "Asset", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "os_", "._", "path_", "._", "basename_", "(_", "asset_", "._", "File_", ")_", "==_", "asset", "\\u", "filename_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "prefa", "b_", "\\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_", "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_", "Convert", "Anim", "_", "(_", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "anim_", ",_", "prefa", "bs_", ",_", "args_", "=_", "params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "anim", "\\u", "path_", "=_", "anim_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "anim_", "=_", "os_", "._", "path_", "._", "basename_", "(_", "anim_", "._", "strip_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prefa", "b", "\\u", "owner_", "=_", "prefa", "bs_", "._", "Get", "Owner_", "(_", "anim_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scale_", "=_", "Resize", "Info_", "._", "Default", "Size_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "prefa", "b", "\\u", "owner_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scale_", "=_", "Resize", "Info_", "._", "Size", "Map_", "[_", "prefa", "b", "\\u", "owner_", "._", "Name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "(", "prefa", "b", "\\u", "owner", ".", "Name", ",", " ", "scale", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "File", "name", " ", "scal", "ing", " ", "override", "s", " ", "genera", "l", " ", "prefa", "b", " ", "settings_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "anim", "\\u", "filename_", "=_", "os_", "._", "path_", "._", "basename_", "(_", "anim_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "anim", "\\u", "name_", ",_", "ext_", "=_", "os_", "._", "path_", "._", "splitext_", "(_", "anim", "\\u", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keys", "\\u", "to", "\\u", "try_", "=_", "[_", "anim_", ",_", "anim", "\\u", "filename_", ",_", "anim", "\\u", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", "in_", "keys", "\\u", "to", "\\u", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scale_", "=_", "Resize", "Info_", "._", "Size", "Map_", "._", "get_", "(_", "key_", ",_", "scale_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "addition", "al", "\\u", "options_", "=_", "Export", "Options_", "._", "Options_", "._", "get_", "(_", "anim", "\\u", "name_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd", "\\u", "args_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "join_", "(_", "SCRIPT", "\\u", "DIR_", ",_", "r", "\"..", "\\\\", "build", "tool", "s", "\\\\", "windows", "\\\\", "python", "2", "7", "\\\\", "python", ".", "exe", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "join_", "(_", "SCRIPT", "\\u", "DIR_", ",_", "r", "\"..", "\\\\", "tool", "s", "\\\\", "scripts", "\\\\", "build", "animati", "on", ".", "py", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"--", "scale", "=\"_", "+_", "str_", "(_", "scale_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "addition", "al", "\\u", "args_", "=_", "(_", "'", "platform", "'_", ",_", "'", "textu", "reformat", "'_", ",_", "'", "hard", "alpha", "textu", "reformat", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "arg_", "in_", "addition", "al", "\\u", "args_", ":_", "\\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 ", " _", "val_", "=_", "getattr_", "(_", "args_", ",_", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd", "\\u", "args_", "._", "append_", "(_", "'--", "{}", "={}'_", "._", "format_", "(_", "arg_", ",_", "val_", ")_", ")_", "\\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_", "addition", "al", "\\u", "flags_", "=_", "(_", "'", "force", "'_", ",_", "'", "square", "'_", ",_", "'", "ignore", "exception", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "flag_", "in_", "addition", "al", "\\u", "flags_", ":_", "\\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 ", " _", "val_", "=_", "getattr_", "(_", "args_", ",_", "flag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "val_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cmd", "\\u", "args_", "._", "append_", "(_", "'--'_", "+_", "flag_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "chdir_", "(_", "SCRIPT", "\\u", "DIR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "src", "\\u", "file_", "=_", "anim", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "anim", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "normpath_", "(_", "os_", "._", "path_", "._", "join_", "(_", "\"..\"_", ",_", "args_", "._", "outputdir_", ",_", "\"", "anim", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "anim", "\\u", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "makedirs_", "(_", "anim", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dest", "\\u", "file_", "=_", "os_", "._", "path_", "._", "join_", "(_", "anim", "\\u", "dir_", ",_", "anim_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "args_", "._", "force_", "or_", "util_", "._", "Is", "File", "New", "er_", "(_", "src", "\\u", "file_", ",_", "dest", "\\u", "file_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cmd", "\\u", "args_", "+=_", "addition", "al", "\\u", "options_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd", "\\u", "args_", "._", "append_", "(_", "src", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd", "\\u", "args_", "._", "append_", "(_", "'--", "output", "dir", "='_", "+_", "args_", "._", "outputdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "'\\\\", "t", "Export", "ing", " ", "'_", "+_", "anim_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "subprocess_", "._", "call_", "(_", "cmd", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
anandology/pyjamas/pyjs/src/pyjs/linker.py
[ { "content": "def module_path(name, path):\n global _path_cache\n candidates = []\n packages = {}\n modules = {}\n if name.endswith('.js'):\n parts = [name]\n else:\n parts = name.split('.')\n if not name in _path_cache:\n _path_cache[name] = {}\n for p in path:\n if p in _path_cache[name]:\n if _path_cache[name][p] is None:\n continue\n return _path_cache[name][p]\n tail = []\n for pn in parts:\n tail.append(pn)\n mn = '.'.join(tail)\n cp = os.path.join(*([p] + tail))\n if mn in _path_cache:\n cache = _path_cache[mn]\n else:\n cache = {}\n _path_cache[mn] = cache\n if p in cache:\n if cache[p] is None:\n break\n elif os.path.isdir(cp) and os.path.exists(\n os.path.join(cp, '__init__.py')):\n cache[p] = os.path.join(cp, '__init__.py')\n elif os.path.exists(cp + '.py'):\n cache[p] = cp + '.py'\n elif pn.endswith('.js') and os.path.exists(cp):\n cache[p] = cp\n else:\n cache[p] = None\n if p in _path_cache[name] and not _path_cache[name][p] is None:\n return _path_cache[name][p]\n _path_cache[name][p] = None\n \n return None\n raise RuntimeError, \"Module %r not found\" % name", "metadata": "root.module_path", "header": "['module', '___EOS___']", "index": 158 } ]
[ { "span": "candidates ", "start_line": 160, "start_column": 4, "end_line": 160, "end_column": 14 }, { "span": "packages ", "start_line": 161, "start_column": 4, "end_line": 161, "end_column": 12 }, { "span": "modules ", "start_line": 162, "start_column": 4, "end_line": 162, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "module", "\\u", "path_", "(_", "name_", ",_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "\\u", "path", "\\u", "cache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "candidates_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "packages_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "modules_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "name_", "._", "endswith_", "(_", "'.", "js", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parts_", "=_", "[_", "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 ", " _", "parts_", "=_", "name_", "._", "split_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "name_", "in_", "\\u", "path", "\\u", "cache_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "path", "\\u", "cache_", "[_", "name_", "]_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "p_", "in_", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "p_", "in_", "\\u", "path", "\\u", "cache_", "[_", "name_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u", "path", "\\u", "cache_", "[_", "name_", "]_", "[_", "p_", "]_", "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_", "return_", "\\u", "path", "\\u", "cache_", "[_", "name_", "]_", "[_", "p_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tail_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "pn_", "in_", "parts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tail_", "._", "append_", "(_", "pn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mn_", "=_", "'.'_", "._", "join_", "(_", "tail_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cp_", "=_", "os_", "._", "path_", "._", "join_", "(_", "*_", "(_", "[_", "p_", "]_", "+_", "tail_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "mn_", "in_", "\\u", "path", "\\u", "cache_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cache_", "=_", "\\u", "path", "\\u", "cache_", "[_", "mn_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cache_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "path", "\\u", "cache_", "[_", "mn_", "]_", "=_", "cache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "p_", "in_", "cache_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "cache_", "[_", "p_", "]_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "os_", "._", "path_", "._", "isdir_", "(_", "cp_", ")_", "and_", "os_", "._", "path_", "._", "exists_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "join_", "(_", "cp_", ",_", "'\\u", "\\u", "init", "\\u\\u", ".", "py", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cache_", "[_", "p_", "]_", "=_", "os_", "._", "path_", "._", "join_", "(_", "cp_", ",_", "'\\u", "\\u", "init", "\\u\\u", ".", "py", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "os_", "._", "path_", "._", "exists_", "(_", "cp_", "+_", "'.", "py", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cache_", "[_", "p_", "]_", "=_", "cp_", "+_", "'.", "py", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "pn_", "._", "endswith_", "(_", "'.", "js", "'_", ")_", "and_", "os_", "._", "path_", "._", "exists_", "(_", "cp_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cache_", "[_", "p_", "]_", "=_", "cp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cache_", "[_", "p_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "p_", "in_", "\\u", "path", "\\u", "cache_", "[_", "name_", "]_", "and_", "not_", "\\u", "path", "\\u", "cache_", "[_", "name_", "]_", "[_", "p_", "]_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "path", "\\u", "cache_", "[_", "name_", "]_", "[_", "p_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "path", "\\u", "cache_", "[_", "name_", "]_", "[_", "p_", "]_", "=_", "None_", "\\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_", "raise_", "Run", "time", "Error_", ",_", "\"", "Modul", "e", " ", "%", "r", " ", "not", " ", "found", "\"_", "%_", "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, 0, 2, 2, 2, 2, 0, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
adobe/brackets-shell/gyp/pylib/gyp/generator/ninja_test.py
[ { "content": "#!/usr/bin/env python\n\n# Copyright (c) 2012 Google Inc. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\n\"\"\" Unit tests for the ninja.py file. \"\"\"\n\nimport gyp.generator.ninja as ninja\nimport unittest\nimport StringIO\nimport sys\nimport TestCommon\n\n\n\nif __name__ == '__main__':\n unittest.main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestPrefixesAndSuffixes(unittest.TestCase):\n if sys.platform in ('win32', 'cygwin'):\n\n if sys.platform == 'linux2':", "metadata": "root.TestPrefixesAndSuffixes", "header": "['module', '___EOS___']", "index": 15 }, { "content": " def test_BinaryNamesWindows(self):\n writer = ninja.NinjaWriter('foo', 'wee', '.', '.', 'ninja.build', 'win')\n spec = { 'target_name': 'wee' }\n self.assertTrue(writer.ComputeOutputFileName(spec, 'executable').\n endswith('.exe'))\n self.assertTrue(writer.ComputeOutputFileName(spec, 'shared_library').\n endswith('.dll'))\n self.assertTrue(writer.ComputeOutputFileName(spec, 'static_library').\n endswith('.lib'))", "metadata": "root.TestPrefixesAndSuffixes.test_BinaryNamesWindows", "header": "['class', 'TestPrefixesAndSuffixes', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 17 }, { "content": " def test_BinaryNamesLinux(self):\n writer = ninja.NinjaWriter('foo', 'wee', '.', '.', 'ninja.build', 'linux')\n spec = { 'target_name': 'wee' }\n self.assertTrue('.' not in writer.ComputeOutputFileName(spec,\n 'executable'))\n self.assertTrue(writer.ComputeOutputFileName(spec, 'shared_library').\n startswith('lib'))\n self.assertTrue(writer.ComputeOutputFileName(spec, 'static_library').\n startswith('lib'))\n self.assertTrue(writer.ComputeOutputFileName(spec, 'shared_library').\n endswith('.so'))\n self.assertTrue(writer.ComputeOutputFileName(spec, 'static_library').\n endswith('.a'))", "metadata": "root.TestPrefixesAndSuffixes.test_BinaryNamesLinux", "header": "['class', 'TestPrefixesAndSuffixes', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 28 } ]
[ { "span": "import StringIO", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 15 }, { "span": "import TestCommon", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 17 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2012", " ", "Goo", "gle", " ", "Inc", ".", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Us", "e", " ", "of", " ", "this", " ", "source", " ", "code", " ", "is", " ", "govern", "ed", " ", "by", " ", "a", " ", "BS", "D", "-", "style", " ", "license", " ", "tha", "t", " ", "can", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "found", " ", "in", " ", "the", " ", "LICENSE", " ", "file", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", " ", "Unit", " ", "tests", " ", "for", " ", "the", " ", "ninja", ".", "py", " ", "file", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "gyp", "_", "._", "generator_", "._", "ninja", "_", "as_", "ninja", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Test", "Common_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\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", "Prefixe", "s", "And", "Su", "ffi", "xes_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "sys_", "._", "platform_", "in_", "(_", "'", "win32", "'_", ",_", "'", "cyg", "win", "'_", ")_", ":_", "\\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_", "if_", "sys_", "._", "platform_", "==_", "'", "linux", "2", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Prefixe", "s", "And", "Su", "ffi", "xes_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "Bin", "ary", "Names", "Windows_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "writer_", "=_", "ninja", "_", "._", "Nin", "ja", "Writer_", "(_", "'", "foo", "'_", ",_", "'", "wee", "'_", ",_", "'.'_", ",_", "'.'_", ",_", "'", "ninja", ".", "build", "'_", ",_", "'", "win", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spec_", "=_", "{_", "'", "target", "\\u", "name", "'_", ":_", "'", "wee", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "writer_", "._", "Compute", "Output", "File", "Name_", "(_", "spec_", ",_", "'", "executable", "'_", ")_", "._", "\\u\\u\\uNL\\u\\u\\u_", "endswith_", "(_", "'.", "exe", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "writer_", "._", "Compute", "Output", "File", "Name_", "(_", "spec_", ",_", "'", "shared", "\\u", "librar", "y", "'_", ")_", "._", "\\u\\u\\uNL\\u\\u\\u_", "endswith_", "(_", "'.", "dll", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "writer_", "._", "Compute", "Output", "File", "Name_", "(_", "spec_", ",_", "'", "static", "\\u", "librar", "y", "'_", ")_", "._", "\\u\\u\\uNL\\u\\u\\u_", "endswith_", "(_", "'.", "lib", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Prefixe", "s", "And", "Su", "ffi", "xes_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "Bin", "ary", "Names", "Lin", "ux_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "writer_", "=_", "ninja", "_", "._", "Nin", "ja", "Writer_", "(_", "'", "foo", "'_", ",_", "'", "wee", "'_", ",_", "'.'_", ",_", "'.'_", ",_", "'", "ninja", ".", "build", "'_", ",_", "'", "linux", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spec_", "=_", "{_", "'", "target", "\\u", "name", "'_", ":_", "'", "wee", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'.'_", "not_", "in_", "writer_", "._", "Compute", "Output", "File", "Name_", "(_", "spec_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "executable", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "writer_", "._", "Compute", "Output", "File", "Name_", "(_", "spec_", ",_", "'", "shared", "\\u", "librar", "y", "'_", ")_", "._", "\\u\\u\\uNL\\u\\u\\u_", "startswith_", "(_", "'", "lib", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "writer_", "._", "Compute", "Output", "File", "Name_", "(_", "spec_", ",_", "'", "static", "\\u", "librar", "y", "'_", ")_", "._", "\\u\\u\\uNL\\u\\u\\u_", "startswith_", "(_", "'", "lib", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "writer_", "._", "Compute", "Output", "File", "Name_", "(_", "spec_", ",_", "'", "shared", "\\u", "librar", "y", "'_", ")_", "._", "\\u\\u\\uNL\\u\\u\\u_", "endswith_", "(_", "'.", "so", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "writer_", "._", "Compute", "Output", "File", "Name_", "(_", "spec_", ",_", "'", "static", "\\u", "librar", "y", "'_", ")_", "._", "\\u\\u\\uNL\\u\\u\\u_", "endswith_", "(_", "'.", "a", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 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 ]
Unused local variable
mozilla/inventory/api_v2/reverse_dns_handler.py
[ { "content": " def read(self, request, reverse_dns_zone=None, reverse_dns_action=None):\n if reverse_dns_zone and reverse_dns_action == 'get_reverse_dns_zones':\n tasks = []\n for task in ScheduledTask.objects.get_all_reverse_dns():\n tasks.append(task.task)\n #ScheduledTask.objects.delete_all_reverse_dns()\n return tasks\n elif reverse_dns_zone and reverse_dns_action == 'get_reverse_dns_zones_with_names':\n truths = Truth.objects.select_related().filter(keyvalue__key='is_reverse_dns_zone',keyvalue__value='True')\n truth_list = []\n for t in truths:\n truth_list.append({'name':t.name.strip(),'description':t.description.strip()})\n return truth_list\n elif reverse_dns_zone and reverse_dns_action == 'view_hosts':\n scope_options = []\n client = Client()\n hosts = json.loads(client.get('/api/keyvalue/?key_type=system_by_zone&zone=%s' % reverse_dns_zone, follow=True).content)\n #print hosts\n adapter_list = []\n for host in hosts:\n if 'hostname' in host:\n the_url = '/api/keyvalue/?key_type=adapters_by_system_and_zone&reverse_dns_zone=%s&system=%s' % (reverse_dns_zone, host['hostname'])\n try:\n adapter_list.append(json.loads(client.get(the_url, follow=True).content))\n except:\n pass\n #d = DHCPInterface(scope_options, adapter_list)\n #return d.get_hosts()\n return None\n else:\n resp = rc.NOT_FOUND\n resp.write(\"I'm sorry but I don't understand your request\")", "metadata": "root.ReverseDNSHandler.read", "header": "['class', 'ReverseDNSHandler', '(', 'BaseHandler', ')', ':', '___EOS___']", "index": 17 } ]
[ { "span": "scope_options ", "start_line": 31, "start_column": 12, "end_line": 31, "end_column": 25 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Revers", "e", "DNS", "Handler_", "(_", "Base", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "read_", "(_", "self_", ",_", "request_", ",_", "reverse", "\\u", "dns", "\\u", "zone_", "=_", "None_", ",_", "reverse", "\\u", "dns", "\\u", "action_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "reverse", "\\u", "dns", "\\u", "zone_", "and_", "reverse", "\\u", "dns", "\\u", "action_", "==_", "'", "get", "\\u", "reverse", "\\u", "dns", "\\u", "zone", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tasks_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "task_", "in_", "Schedule", "d", "Task_", "._", "objects_", "._", "get", "\\u", "all", "\\u", "reverse", "\\u", "dns_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tasks_", "._", "append_", "(_", "task_", "._", "task_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Schedule", "d", "Task", ".", "object", "s", ".", "delete", "\\u", "all", "\\u", "reverse", "\\u", "dns", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "tasks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "reverse", "\\u", "dns", "\\u", "zone_", "and_", "reverse", "\\u", "dns", "\\u", "action_", "==_", "'", "get", "\\u", "reverse", "\\u", "dns", "\\u", "zone", "s", "\\u", "with", "\\u", "names", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "truth", "s_", "=_", "Tru", "th_", "._", "objects_", "._", "select", "\\u", "related_", "(_", ")_", "._", "filter_", "(_", "keyval", "ue", "\\u\\u", "key_", "=_", "'", "is", "\\u", "reverse", "\\u", "dns", "\\u", "zone", "'_", ",_", "keyval", "ue", "\\u\\u", "value_", "=_", "'", "Tru", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "truth", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "t_", "in_", "truth", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "truth", "\\u", "list_", "._", "append_", "(_", "{_", "'", "name", "'_", ":_", "t_", "._", "name_", "._", "strip_", "(_", ")_", ",_", "'", "description", "'_", ":_", "t_", "._", "description_", "._", "strip_", "(_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "truth", "\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "reverse", "\\u", "dns", "\\u", "zone_", "and_", "reverse", "\\u", "dns", "\\u", "action_", "==_", "'", "view", "\\u", "host", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scope", "\\u", "options_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "Client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hosts_", "=_", "json_", "._", "loads_", "(_", "client_", "._", "get_", "(_", "'/", "api", "/", "keyval", "ue", "/?", "key", "\\u", "type", "=", "system", "\\u", "by", "\\u", "zone", "&", "zone", "=", "%", "s", "'_", "%_", "reverse", "\\u", "dns", "\\u", "zone_", ",_", "follow_", "=_", "True_", ")_", "._", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "hosts_", "\\u\\u\\uNL\\u\\u\\u_", "adapter", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "host_", "in_", "hosts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "host", "name", "'_", "in_", "host_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "the", "\\u", "url_", "=_", "'/", "api", "/", "keyval", "ue", "/?", "key", "\\u", "type", "=", "adapter", "s", "\\u", "by", "\\u", "system", "\\u", "and", "\\u", "zone", "&", "reverse", "\\u", "dns", "\\u", "zone", "=", "%", "s", "&", "system", "=", "%", "s", "'_", "%_", "(_", "reverse", "\\u", "dns", "\\u", "zone_", ",_", "host_", "[_", "'", "host", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "adapter", "\\u", "list_", "._", "append_", "(_", "json_", "._", "loads_", "(_", "client_", "._", "get_", "(_", "the", "\\u", "url_", ",_", "follow_", "=_", "True_", ")_", "._", "content_", ")_", ")_", "\\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_", "#", "d", " ", "=", " ", "DHC", "PI", "nter", "face", "(", "scope", "\\u", "options", ",", " ", "adapter", "\\u", "list", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "return", " ", "d", ".", "get", "\\u", "host", "s", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "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 ", " _", "resp_", "=_", "rc_", "._", "NOT", "\\u", "FOUND_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "._", "write_", "(_", "\"", "I", "'", "m", " ", "sorr", "y", " ", "but", " ", "I", " ", "don", "'", "t", " ", "underst", "and", " ", "your", " ", "request", "\"_", ")_" ]
[ 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,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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 ]
Unused import
kivy/python-for-android/pythonforandroid/recipes/zope_interface/__init__.py
[ { "content": "\nfrom pythonforandroid.toolchain import PythonRecipe, shprint, current_directory\nfrom os.path import join\nimport sh\n\n\n\nrecipe = ZopeInterfaceRecipe()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ZopeInterfaceRecipe(PythonRecipe):\n name = 'zope_interface'\n version = '4.1.2'\n url = 'https://pypi.python.org/packages/source/z/zope.interface/zope.interface-{version}.tar.gz'\n site_packages_name = 'zope.interface'\n\n depends = ['python2']\n", "metadata": "root.ZopeInterfaceRecipe", "header": "['module', '___EOS___']", "index": 6 }, { "content": " def build_arch(self, arch):\n super(ZopeInterfaceRecipe, self).build_arch(arch)\n print('Should remove zope tests etc. here, but skipping for now')", "metadata": "root.ZopeInterfaceRecipe.build_arch", "header": "['class', 'ZopeInterfaceRecipe', '(', 'PythonRecipe', ')', ':', '___EOS___']", "index": 14 } ]
[ { "span": "from pythonforandroid.toolchain import PythonRecipe, shprint, current_directory", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 79 }, { "span": "from os.path import join", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 24 }, { "span": "import sh", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 9 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "python", "fora", "ndr", "oid_", "._", "toolchain_", "import_", "Pyth", "on", "Recipe_", ",_", "shp", "rint_", ",_", "current", "\\u", "directory_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "os_", "._", "path_", "import_", "join_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sh_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "recipe_", "=_", "Zo", "pe", "Interface", "Recipe_", "(_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Zo", "pe", "Interface", "Recipe_", "(_", "Pyth", "on", "Recipe_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "'", "zop", "e\\u", "interface", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "version_", "=_", "'", "4.1", ".2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "'", "https", "://", "pypi", ".", "python", ".", "org", "/", "package", "s", "/", "source", "/", "z", "/", "zop", "e", ".", "interface", "/", "zop", "e", ".", "interface", "-", "{", "version", "}.", "tar", ".", "gz", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "site", "\\u", "package", "s", "\\u", "name_", "=_", "'", "zop", "e", ".", "interface", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "depends_", "=_", "[_", "'", "python", "2", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Zo", "pe", "Interface", "Recipe_", "(_", "Pyth", "on", "Recipe_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "build", "\\u", "arch_", "(_", "self_", ",_", "arch_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Zo", "pe", "Interface", "Recipe_", ",_", "self_", ")_", "._", "build", "\\u", "arch_", "(_", "arch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "Sho", "ul", "d", " ", "remove", " ", "zop", "e", " ", "tests", " ", "etc", ".", " ", "here", ",", " ", "but", " ", "skip", "ping", " ", "for", " ", "now", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
OrbitzWorldwide/droned/droned/lib/droned/responders/core.py
[ { "content": "@responder(pattern=\"^@(?P<command>.+)\", context_key='server', form=\"@<command>\", help=\"Run a droned command on the current server\")\[email protected]\ndef droneblast(conversation, command):\n server = conversation.context.get('server')\n response = None\n d = None\n try:\n if not isinstance(server, Server):\n conversation.say('On what <b>server</b>?')\n raise AssertionError('incomplete converation context')\n\n options = {}\n if 'timeout' in conversation.context:\n options['timeout'] = conversation.context['timeout']\n\n try:\n conversation.say(\"Running droned command...\")\n d = server.manager.run(command, **options)\n deferreds = conversation.context.get('deferreds', [])\n deferreds.append(d)\n conversation.context.update({'deferreds': deferreds})\n wfd = defer.waitForDeferred(d)\n yield wfd\n result = wfd.getResult()\n except:\n failure = Failure()\n if failure.check(DroneCommandFailed):\n rc = failure.value.resultContext\n conversation.say(rc.get('description') or str(rc), useHTML=False)\n else:\n conversation.say(failure.getTraceback(), useHTML=False)\n else:\n if isinstance(result, dict):\n output = result.values()[0].get('description', str(result))\n else:\n output = str(result)\n deferreds = conversation.context.get('deferreds', [])\n try: deferreds.remove(d)\n except: pass\n conversation.context.update({'deferreds': deferreds})\n conversation.say(\"Command completed\\n%s\" % output, useHTML=False)\n except AssertionError: pass\n except:\n result = Failure()\n yield result", "metadata": "root.droneblast", "header": "['module', '___EOS___']", "index": 73 } ]
[ { "span": "response ", "start_line": 77, "start_column": 4, "end_line": 77, "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_", "@_", "responder", "_", "(_", "pattern_", "=_", "\"", "^", "@(", "?", "P", "<", "command", ">.+)", "\"_", ",_", "context", "\\u", "key_", "=_", "'", "server", "'_", ",_", "form_", "=_", "\"@", "<", "command", ">\"_", ",_", "help_", "=_", "\"", "Run", " ", "a", " ", "drone", "d", " ", "command", " ", "on", " ", "the", " ", "current", " ", "server", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "defer_", "._", "defer", "red", "Generator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "drone", "blast", "_", "(_", "conversation_", ",_", "command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "server_", "=_", "conversation_", "._", "context_", "._", "get_", "(_", "'", "server", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "server_", ",_", "Server_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conversation_", "._", "say_", "(_", "'", "On", " ", "what", " ", "<", "b", ">", "server", "</", "b", ">", "?'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Assert", "ion", "Error_", "(_", "'", "incomplete", " ", "conve", "ration", " ", "context", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "options_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "timeo", "ut", "'_", "in_", "conversation_", "._", "context_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "[_", "'", "timeo", "ut", "'_", "]_", "=_", "conversation_", "._", "context_", "[_", "'", "timeo", "ut", "'_", "]_", "\\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 ", " _", "conversation_", "._", "say_", "(_", "\"", "Run", "ning", " ", "drone", "d", " ", "command", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "server_", "._", "manager_", "._", "run_", "(_", "command_", ",_", "**_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "defer", "reds", "_", "=_", "conversation_", "._", "context_", "._", "get_", "(_", "'", "defer", "reds", "'_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "defer", "reds", "_", "._", "append_", "(_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conversation_", "._", "context_", "._", "update_", "(_", "{_", "'", "defer", "reds", "'_", ":_", "defer", "reds", "_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wf", "d_", "=_", "defer_", "._", "wait", "For", "Deferred_", "(_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "wf", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wf", "d_", "._", "get", "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 ", " _", "failure_", "=_", "Failure_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "failure_", "._", "check_", "(_", "Dro", "ne", "Command", "Failed_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rc_", "=_", "failure_", "._", "value_", "._", "result", "Context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conversation_", "._", "say_", "(_", "rc_", "._", "get_", "(_", "'", "description", "'_", ")_", "or_", "str_", "(_", "rc_", ")_", ",_", "use", "HTML_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conversation_", "._", "say_", "(_", "failure_", "._", "get", "Trace", "back_", "(_", ")_", ",_", "use", "HTML_", "=_", "False_", ")_", "\\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_", "(_", "result_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output_", "=_", "result_", "._", "values_", "(_", ")_", "[_", "0_", "]_", "._", "get_", "(_", "'", "description", "'_", ",_", "str_", "(_", "result_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output_", "=_", "str_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "defer", "reds", "_", "=_", "conversation_", "._", "context_", "._", "get_", "(_", "'", "defer", "reds", "'_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "defer", "reds", "_", "._", "remove_", "(_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conversation_", "._", "context_", "._", "update_", "(_", "{_", "'", "defer", "reds", "'_", ":_", "defer", "reds", "_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conversation_", "._", "say_", "(_", "\"", "Command", " ", "complete", "d", "\\\\", "n", "%", "s", "\"_", "%_", "output_", ",_", "use", "HTML_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Testing equality to None
VisTrails/VisTrails/contrib/NumSciPy/ArrayPlot.py
[ { "content": " def get_label(self, ar, i):\n lab = ar.get_name(i)\n if lab == None:\n return 'Array ' + str(i)\n else:\n return lab", "metadata": "root.ArrayPlot.get_label", "header": "['class', 'ArrayPlot', '(', 'object', ')', ':', '___EOS___']", "index": 14 }, { "content": " def get_color(self, colors, i, randomcolor):\n if randomcolor:\n return (random.random(), random.random(), random.random())\n\n if self.color_dict == None:\n self.color_dict = {}\n for (k,r,g,b) in colors:\n self.color_dict[k] = (r,g,b)\n\n if self.color_dict.has_key(i):\n return self.color_dict[i]\n else:\n return None", "metadata": "root.ArrayPlot.get_color", "header": "['class', 'ArrayPlot', '(', 'object', ')', ':', '___EOS___']", "index": 24 }, { "content": " def get_marker(self, markers, i):\n if markers == None:\n return None\n\n if self.marker_dict == None:\n self.marker_dict = {}\n for (k,m) in markers:\n self.marker_dict[k] = m\n\n if self.marker_dict.has_key(i):\n return self.marker_dict[i]\n else:\n return None", "metadata": "root.ArrayPlot.get_marker", "header": "['class', 'ArrayPlot', '(', 'object', ')', ':', '___EOS___']", "index": 38 }, { "content": " def compute(self):\n data = self.get_input(\"Data Array\")\n da_ar = data.get_array().squeeze()\n if da_ar.ndim != 2:\n raise ModuleError(\"Input Data Array must have dimension = 2\")\n\n aspect_ratio = self.force_get_input(\"Aspect Ratio\")\n colormap = self.force_get_input(\"Colormap\")\n colorbar = self.force_get_input(\"Colorbar\")\n extents = self.force_get_input(\"Extents\")\n\n # Quickly check the assigned colormap to make sure it's valid\n if colormap == None:\n colormap = \"jet\"\n if not hasattr(pylab, colormap):\n colormap = \"jet\"\n \n bg_color = self.force_get_input(\"Background\")\n array_x_t = self.force_get_input(\"Use X Title\")\n array_y_t = self.force_get_input(\"Use Y Title\")\n\n p_title = self.force_get_input(\"Title\")\n x_label = self.force_get_input(\"X Title\")\n y_label = self.force_get_input(\"Y Title\")\n \n s = urllib.unquote(str(self.force_get_input(\"source\", '')))\n\n s = 'from pylab import *\\n' +\\\n 'from numpy import *\\n' +\\\n 'import numpy\\n'\n \n if bg_color == None:\n bg_color = 'w'\n\n if type(bg_color) == type(''):\n s += 'figure(facecolor=\\'' + bg_color + '\\')\\n'\n else:\n s += 'figure(facecolor=' + str(bg_color) + ')\\n'\n\n s += 'imshow(da_ar, interpolation=\\'bicubic\\''\n if aspect_ratio != None:\n s += ', aspect=' + str(aspect_ratio)\n\n if extents != None:\n s += ', extent=['+str(extents[0])+','+str(extents[1])+','+str(extents[2])+','+str(extents[3])+']'\n s += ')\\n'\n\n s += colormap + '()\\n'\n\n if colorbar:\n s += 'colorbar()\\n'\n\n if array_x_t:\n s += 'xlabel(\\'' + data.get_domain_name() + '\\')\\n'\n elif x_label:\n s += 'xlabel(\\'' + x_label + '\\')\\n'\n\n if array_y_t:\n s += 'ylabel(\\'' + data.get_range_name() + '\\')\\n'\n elif y_label:\n s += 'ylabel(\\'' + y_label + '\\')\\n'\n\n if p_title:\n s += 'title(\\'' + p_title + '\\')\\n'\n\n exec s\n self.set_output('source', s)", "metadata": "root.ArrayImage.compute", "header": "['class', 'ArrayImage', '(', 'ArrayPlot', ',', 'Module', ')', ':', '___EOS___']", "index": 65 }, { "content": " def compute(self):\n data = self.get_input_list(\"Data Array\")\n self.label_dict = None\n self.color_dict = None\n use_legend = self.force_get_input(\"Legend\")\n randomcolors = self.force_get_input(\"Random Colors\")\n colors = self.force_get_input_list(\"Colors\")\n bg_color = self.force_get_input(\"Background\")\n array_x_t = self.force_get_input(\"Use X Title\")\n array_y_t = self.force_get_input(\"Use Y Title\")\n p_title = self.force_get_input(\"Title\")\n x_label = self.force_get_input(\"X Title\")\n nbins = self.force_get_input(\"Bins\")\n if nbins == None:\n nbins = 10\n normed = self.force_get_input(\"Normalize\")\n if normed == None:\n normed = False\n\n s = urllib.unquote(str(self.force_get_input(\"source\", '')))\n self.source = ''\n\n s = 'from pylab import *\\n' +\\\n 'from numpy import *\\n' +\\\n 'import numpy\\n'\n \n if bg_color == None:\n bg_color = 'w'\n\n if type(bg_color) == type(''):\n s += 'figure(facecolor=\\'' + bg_color + '\\')\\n'\n else:\n s += 'figure(facecolor=' + str(bg_color) + ')\\n'\n\n data_list = []\n for i in data:\n data_list.append(i.get_array().squeeze())\n\n da_ar = None\n try:\n da_ar = numpy.array(data_list)\n except:\n raise ModuleException(\"Not all Data Array inputs are the same size!\")\n\n for i in range(da_ar.shape[0]):\n lab = self.get_label(data[i], i)\n col = self.get_color(colors, i, randomcolors)\n\n s += 'hist(da_ar['+str(i)+',:], bins=' + str(nbins)\n \n if lab != None:\n s += ', label=\\'' + lab + '\\''\n if col != None:\n s += ', facecolor=' + str(col)\n\n s += ', normed='+str(normed)\n s += ')\\n'\n\n if use_legend:\n s += 'legend()\\n'\n\n if array_x_t:\n s += 'xlabel(\\'' + data[0].get_domain_name() + '\\')\\n'\n elif x_label:\n s += 'xlabel(\\'' + x_label + '\\')\\n'\n\n if array_y_t:\n s += 'ylabel(\\'Histogram Value\\')\\n'\n\n if p_title:\n s += 'title(\\'' + p_title + '\\')\\n'\n\n exec s\n self.set_output(\"source\", s) ", "metadata": "root.Histogram.compute", "header": "['class', 'Histogram', '(', 'ArrayPlot', ',', 'Module', ')', ':', '___EOS___']", "index": 162 }, { "content": " def compute(self):\n data = self.get_input_list(\"Data\")\n errs = self.force_get_input_list(\"Error Bars\")\n if len(errs) == 0:\n errs = None\n\n self.label_dict = None\n self.color_dict = None\n use_legend = self.force_get_input(\"Legend\")\n randomcolors = self.force_get_input(\"Random Colors\")\n colors = self.force_get_input_list(\"Colors\")\n bg_color = self.force_get_input(\"Background\")\n array_x_t = self.force_get_input(\"Use X Title\")\n array_y_t = self.force_get_input(\"Use Y Title\")\n ticks = self.force_get_input_list(\"Bar Labels\")\n self.tick_dict = {}\n for (k,v) in ticks:\n self.tick_dict[k] = v\n p_title = self.force_get_input(\"Title\")\n x_label = self.force_get_input(\"X Title\")\n y_label = self.force_get_input(\"Y Title\")\n\n width = self.force_get_input(\"Bar Width\")\n if width == None:\n width = 0.5\n\n if errs != None:\n if len(data) != len(errs):\n raise ModuleError(\"Number of data does not match number of error bar data\")\n\n s = urllib.unquote(str(self.force_get_input(\"source\", '')))\n self.source = ''\n\n s = 'from pylab import *\\n' +\\\n 'from numpy import *\\n' +\\\n 'import numpy\\n'\n \n if bg_color == None:\n bg_color = 'w'\n\n if type(bg_color) == type(''):\n s += 'figure(facecolor=\\'' + bg_color + '\\')\\n'\n else:\n s += 'figure(facecolor=' + str(bg_color) + ')\\n'\n\n numpts = None\n ind = None\n prev = None\n ind = numpy.arange(data[0].get_array().flatten().shape[0])\n t = self.get_ticks(data[0].get_array().flatten().shape[0])\n ag_ar = numpy.zeros((len(data), data[0].get_array().flatten().shape[0]))\n for i in range(len(data)):\n da_ar = data[i].get_array().flatten()\n ag_ar[i,:] = da_ar\n\n er_ar = numpy.zeros((len(data), data[0].get_array().flatten().shape[0]))\n if errs != None:\n for i in range(len(data)):\n er_ar[i,:] = errs[i].get_array().flatten()\n \n for i in range(ag_ar.shape[0]):\n s += 'bar(ind, ag_ar[' + str(i) + ',:], width'\n lab = self.get_label(data[i], i)\n col = self.get_color(colors, i, randomcolors)\n if lab != None:\n s += ', label=\\'' + lab + '\\''\n if col != None:\n s += ', color=' + str(col)\n\n if errs != None:\n s += ', yerr=er_ar[' + str(i) + ',:]'\n\n if prev != None:\n s += ', bottom=ag_ar[' + str(i-1) + ',:]'\n\n s += ')\\n'\n prev = ag_ar[i]\n \n if use_legend:\n s += 'legend()\\n'\n\n if array_x_t:\n s += 'xlabel(\\'' + data[0].get_domain_name() + '\\')\\n'\n elif x_label:\n s += 'xlabel(\\'' + x_label + '\\')\\n'\n\n if array_y_t:\n s += 'ylabel(\\'' + data[0].get_range_name() + '\\')\\n'\n elif y_label:\n s += 'ylabel(\\'' + y_label + '\\')\\n'\n\n if p_title:\n s += 'title(\\'' + p_title + '\\')\\n'\n\n s += 'xticks(ind + width/2., t)\\n'\n exec s\n self.set_output(\"source\", s)", "metadata": "root.BarChart.compute", "header": "['class', 'BarChart', '(', 'ArrayPlot', ',', 'Module', ')', ':', '___EOS___']", "index": 276 }, { "content": " def compute(self):\n xdata = self.get_input_list(\"X Array\")\n ydata = self.get_input_list(\"Y Array\")\n self.label_dict = None\n use_legend = self.force_get_input(\"Legend\")\n randomcolors = self.force_get_input(\"Random Colors\")\n colors = self.force_get_input_list(\"Colors\")\n self.color_dict = None\n bg_color = self.force_get_input(\"Background\")\n markers = self.force_get_input_list(\"Markers\")\n self.marker_dict = None\n ps = self.force_get_input(\"Point Size\")\n array_x_t = self.force_get_input(\"Use X Title\")\n array_y_t = self.force_get_input(\"Use Y Title\")\n\n p_title = self.force_get_input(\"Title\")\n x_label = self.force_get_input(\"X Title\")\n y_label = self.force_get_input(\"Y Title\")\n\n s = urllib.unquote(str(self.force_get_input(\"source\", '')))\n self.source = ''\n\n if len(xdata) != len(ydata):\n raise ModuleError(\"Cannot create scatter plot for different number of X and Y datasets.\")\n\n s = 'from pylab import *\\n' +\\\n 'from numpy import *\\n' +\\\n 'import numpy\\n'\n \n if bg_color == None:\n bg_color = 'w'\n\n if type(bg_color) == type(''):\n s += 'figure(facecolor=\\'' + bg_color + '\\')\\n'\n else:\n s += 'figure(facecolor=' + str(bg_color) + ')\\n'\n\n xdata_ar = numpy.zeros((len(xdata), xdata[0].get_array().flatten().shape[0]))\n ydata_ar = numpy.zeros((len(xdata), xdata[0].get_array().flatten().shape[0]))\n\n for i in range(len(xdata)):\n xd = xdata[i]\n yd = ydata[i]\n xdata_ar[i,:] = xd.get_array().flatten()\n ydata_ar[i,:] = yd.get_array().flatten()\n \n for i in range(len(xdata)):\n xar = xdata[i]\n yar = ydata[i]\n\n lab = self.get_label(xar, i)\n col = self.get_color(colors, i, randomcolors)\n mar = self.get_marker(markers, i)\n\n s += 'scatter(xdata_ar[' + str(i) +',:], ydata_ar[' + str(i) + ',:]'\n \n if lab != None:\n s += ', label=\\'' + lab +'\\''\n if col != None:\n s += ', color=' + str(col)\n if mar != None:\n s += ', marker=\\'' + mar + '\\''\n if ps != None:\n s += ', size=' + str(ps)\n s += ')\\n'\n\n if use_legend:\n s += 'legend()\\n'\n\n if array_x_t:\n s += 'xlabel(\\'' + xar.get_domain_name() + '\\')\\n'\n elif x_label:\n s += 'xlabel(\\'' + x_label + '\\')\\n'\n\n if array_y_t:\n s += 'ylabel(\\'' + yar.get_domain_name() + '\\')\\n'\n elif y_label:\n s += 'ylabel(\\'' + y_label + '\\')\\n'\n\n if p_title:\n s += 'title(\\'' + p_title + '\\')\\n'\n\n print s\n exec s\n self.set_output(\"source\", s)", "metadata": "root.ScatterPlot.compute", "header": "['class', 'ScatterPlot', '(', 'ArrayPlot', ',', 'Module', ')', ':', '___EOS___']", "index": 404 }, { "content": " def compute(self):\n data = self.get_input(\"Input Array\")\n indexes = self.force_get_input(\"Indexes\")\n self.label_dict = None\n use_legend = self.force_get_input(\"Legend\")\n randomcolors = self.force_get_input(\"Random Colors\")\n colors = self.force_get_input_list(\"Colors\")\n self.color_dict = None\n markers = self.force_get_input_list(\"Markers\")\n self.marker_dict = None\n x_label = self.force_get_input(\"X Title\")\n y_label = self.force_get_input(\"Y Title\")\n p_title = self.force_get_input(\"Title\")\n bg_color = self.force_get_input(\"Background\")\n\n array_x_t = self.force_get_input(\"Use X Title\")\n array_y_t = self.force_get_input(\"Use Y Title\")\n\n s = urllib.unquote(str(self.force_get_input(\"source\", '')))\n self.source = ''\n da_ar = data.get_array()\n\n if da_ar.ndim > 2:\n raise ModuleError(\"Cannot plot data with dimensions > 2\")\n \n s = 'from pylab import *\\n' +\\\n 'from numpy import *\\n' +\\\n 'import numpy\\n'\n \n if bg_color == None:\n bg_color = 'w'\n\n if type(bg_color) == type(''):\n s += 'figure(facecolor=\\'' + bg_color + '\\')\\n'\n else:\n s += 'figure(facecolor=' + str(bg_color) + ')\\n'\n \n if da_ar.ndim == 1:\n da_ar.shape = (1, da_ar.shape[0])\n\n xar = self.force_get_input(\"X Values\")\n sf = self.force_get_input(\"Scaling Factor\")\n if sf == None:\n sf = 1.\n\n if xar == None:\n start_i = None\n end_i = None\n if indexes == None:\n start_i = 0\n end_i = da_ar.shape[1]\n else:\n start_i = indexes[0]\n end_i = indexes[1]\n\n xar = numpy.arange(start_i, end_i)\n xar = xar * sf\n else:\n xar = xar.get_array()\n \n print da_ar.shape\n print xar.shape\n for i in range(da_ar.shape[0]):\n lab = self.get_label(data, i)\n col = self.get_color(colors, i, randomcolors)\n mar = self.get_marker(markers, i)\n if indexes == None:\n s += 'plot(xar, da_ar[' + str(i) + ',:]'\n else:\n s += 'plot(xar, da_ar[' + str(i) + ',' + str(indexes[0]) + ':' + str(indexes[1]) + ']'\n \n if lab != None:\n s += ', label=\\'' + lab +'\\''\n if col != None:\n s += ', color=' + str(col)\n if mar != None:\n s += ', marker=\\'' + mar + '\\''\n s += ')\\n'\n\n if use_legend:\n s += 'legend()\\n'\n\n if array_x_t:\n s += 'xlabel(\\'' + data.get_domain_name() + '\\')\\n'\n elif x_label:\n s += 'xlabel(\\'' + x_label + '\\')\\n'\n\n if array_y_t:\n s += 'ylabel(\\'' + data.get_range_name() + '\\')\\n'\n elif y_label:\n s += 'ylabel(\\'' + y_label + '\\')\\n'\n\n if p_title:\n s += 'title(\\'' + p_title + '\\')\\n'\n\n exec s\n self.set_output(\"source\", s)", "metadata": "root.LinePlot.compute", "header": "['class', 'LinePlot', '(', 'ArrayPlot', ',', 'Module', ')', ':', '___EOS___']", "index": 518 } ]
[ { "span": "lab == None:", "start_line": 16, "start_column": 11, "end_line": 16, "end_column": 22 }, { "span": "self.color_dict == None:", "start_line": 28, "start_column": 11, "end_line": 28, "end_column": 34 }, { "span": "markers == None:", "start_line": 39, "start_column": 11, "end_line": 39, "end_column": 26 }, { "span": "self.marker_dict == None:", "start_line": 42, "start_column": 11, "end_line": 42, "end_column": 35 }, { "span": "colormap == None:", "start_line": 77, "start_column": 11, "end_line": 77, "end_column": 27 }, { "span": "bg_color == None:", "start_line": 96, "start_column": 11, "end_line": 96, "end_column": 27 }, { "span": "nbins == None:", "start_line": 175, "start_column": 11, "end_line": 175, "end_column": 24 }, { "span": "normed == None:", "start_line": 178, "start_column": 11, "end_line": 178, "end_column": 25 }, { "span": "bg_color == None:", "start_line": 188, "start_column": 11, "end_line": 188, "end_column": 27 }, { "span": "width == None:", "start_line": 299, "start_column": 11, "end_line": 299, "end_column": 24 }, { "span": "bg_color == None:", "start_line": 313, "start_column": 11, "end_line": 313, "end_column": 27 }, { "span": "bg_color == None:", "start_line": 433, "start_column": 11, "end_line": 433, "end_column": 27 }, { "span": "bg_color == None:", "start_line": 547, "start_column": 11, "end_line": 547, "end_column": 27 }, { "span": "sf == None:", "start_line": 560, "start_column": 11, "end_line": 560, "end_column": 21 }, { "span": "xar == None:", "start_line": 563, "start_column": 11, "end_line": 563, "end_column": 22 }, { "span": "indexes == None:", "start_line": 566, "start_column": 15, "end_line": 566, "end_column": 30 }, { "span": "indexes == None:", "start_line": 584, "start_column": 15, "end_line": 584, "end_column": 30 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "Array", "Plot_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "label_", "(_", "self_", ",_", "ar_", ",_", "i_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lab_", "=_", "ar_", "._", "get", "\\u", "name_", "(_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "lab_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "Array", " ", "'_", "+_", "str_", "(_", "i_", ")_", "\\u\\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_", "lab_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Array", "Plot_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "color_", "(_", "self_", ",_", "colors_", ",_", "i_", ",_", "random", "color_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "random", "color_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "random_", "._", "random_", "(_", ")_", ",_", "random_", "._", "random_", "(_", ")_", ",_", "random_", "._", "random_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "color", "\\u", "dict_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "color", "\\u", "dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "k_", ",_", "r_", ",_", "g_", ",_", "b_", ")_", "in_", "colors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "color", "\\u", "dict_", "[_", "k_", "]_", "=_", "(_", "r_", ",_", "g_", ",_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "color", "\\u", "dict_", "._", "has", "\\u", "key_", "(_", "i_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "color", "\\u", "dict_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Array", "Plot_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "marker_", "(_", "self_", ",_", "markers_", ",_", "i_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "markers_", "==_", "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_", "if_", "self_", "._", "marker", "\\u", "dict_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "marker", "\\u", "dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "k_", ",_", "m_", ")_", "in_", "markers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "marker", "\\u", "dict_", "[_", "k_", "]_", "=_", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "marker", "\\u", "dict_", "._", "has", "\\u", "key_", "(_", "i_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "marker", "\\u", "dict_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Array", "Image_", "(_", "Array", "Plot_", ",_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Data", " ", "Array", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "da", "\\u", "ar_", "=_", "data_", "._", "get", "\\u", "array_", "(_", ")_", "._", "squeeze_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "da", "\\u", "ar_", "._", "ndim_", "!=_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Modul", "e", "Error_", "(_", "\"", "Inp", "ut", " ", "Data", " ", "Array", " ", "must", " ", "have", " ", "dimension", " ", "=", " ", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "aspect", "\\u", "ratio_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Asp", "ect", " ", "Rati", "o", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "colormap_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Color", "map", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "colorbar_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Color", "bar", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extents_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Extent", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Qui", "ckl", "y", " ", "check", " ", "the", " ", "assign", "ed", " ", "colormap", " ", "to", " ", "make", " ", "sure", " ", "it", "'", "s", " ", "valid_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "colormap_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "colormap_", "=_", "\"", "jet", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "hasattr_", "(_", "pylab_", ",_", "colormap_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "colormap_", "=_", "\"", "jet", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "bg", "\\u", "color_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Back", "ground", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "array", "\\u", "x", "\\u", "t_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Us", "e", " ", "X", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "array", "\\u", "y", "\\u", "t_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Us", "e", " ", "Y", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p", "\\u", "title_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x", "\\u", "label_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "X", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "\\u", "label_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Y", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "urllib_", "._", "unquote_", "(_", "str_", "(_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "source", "\"_", ",_", "''_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "'", "from", " ", "pyla", "b", " ", "import", " ", "*\\\\", "n", "'_", "+_", "'", "from", " ", "nump", "y", " ", "import", " ", "*\\\\", "n", "'_", "+_", "'", "import", " ", "nump", "y", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "bg", "\\u", "color_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bg", "\\u", "color_", "=_", "'", "w", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "type_", "(_", "bg", "\\u", "color_", ")_", "==_", "type_", "(_", "''_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "figure", "(", "face", "color", "=\\\\", "''_", "+_", "bg", "\\u", "color_", "+_", "'\\\\'", ")\\\\", "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 ", " _", "s_", "+=_", "'", "figure", "(", "face", "color", "='_", "+_", "str_", "(_", "bg", "\\u", "color_", ")_", "+_", "')", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "+=_", "'", "ims", "how", "(", "da", "\\u", "ar", ",", " ", "interpolati", "on", "=\\\\", "'", "bic", "ubi", "c", "\\\\''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "aspect", "\\u", "ratio_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", " ", "aspect", "='_", "+_", "str_", "(_", "aspect", "\\u", "ratio_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "extents_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", " ", "extent", "=[", "'_", "+_", "str_", "(_", "extents_", "[_", "0_", "]_", ")_", "+_", "','_", "+_", "str_", "(_", "extents_", "[_", "1_", "]_", ")_", "+_", "','_", "+_", "str_", "(_", "extents_", "[_", "2_", "]_", ")_", "+_", "','_", "+_", "str_", "(_", "extents_", "[_", "3_", "]_", ")_", "+_", "']'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "+=_", "')", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "+=_", "colormap_", "+_", "'(", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "colorbar_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "colorbar", "()", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "array", "\\u", "x", "\\u", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "xlabel", "(\\\\'", "'_", "+_", "data_", "._", "get", "\\u", "domain", "\\u", "name_", "(_", ")_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "x", "\\u", "label_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "xlabel", "(\\\\'", "'_", "+_", "x", "\\u", "label_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "array", "\\u", "y", "\\u", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "ylabel", "(\\\\'", "'_", "+_", "data_", "._", "get", "\\u", "range", "\\u", "name_", "(_", ")_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "y", "\\u", "label_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "ylabel", "(\\\\'", "'_", "+_", "y", "\\u", "label_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "p", "\\u", "title_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "title", "(\\\\'", "'_", "+_", "p", "\\u", "title_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exec_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "'", "source", "'_", ",_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Histogram", "_", "(_", "Array", "Plot_", ",_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "self_", "._", "get", "\\u", "input", "\\u", "list_", "(_", "\"", "Data", " ", "Array", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "label", "\\u", "dict_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "color", "\\u", "dict_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "use", "\\u", "legend_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Legend", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "random", "colors_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Random", " ", "Color", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "colors_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input", "\\u", "list_", "(_", "\"", "Color", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bg", "\\u", "color_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Back", "ground", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "array", "\\u", "x", "\\u", "t_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Us", "e", " ", "X", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "array", "\\u", "y", "\\u", "t_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Us", "e", " ", "Y", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p", "\\u", "title_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x", "\\u", "label_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "X", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nbins_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Bin", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "nbins_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nbins_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "normed_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Normalize", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "normed_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "normed_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "=_", "urllib_", "._", "unquote_", "(_", "str_", "(_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "source", "\"_", ",_", "''_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "source_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "'", "from", " ", "pyla", "b", " ", "import", " ", "*\\\\", "n", "'_", "+_", "'", "from", " ", "nump", "y", " ", "import", " ", "*\\\\", "n", "'_", "+_", "'", "import", " ", "nump", "y", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "bg", "\\u", "color_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bg", "\\u", "color_", "=_", "'", "w", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "type_", "(_", "bg", "\\u", "color_", ")_", "==_", "type_", "(_", "''_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "figure", "(", "face", "color", "=\\\\", "''_", "+_", "bg", "\\u", "color_", "+_", "'\\\\'", ")\\\\", "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 ", " _", "s_", "+=_", "'", "figure", "(", "face", "color", "='_", "+_", "str_", "(_", "bg", "\\u", "color_", ")_", "+_", "')", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data\\u", "list_", "._", "append_", "(_", "i_", "._", "get", "\\u", "array_", "(_", ")_", "._", "squeeze_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "da", "\\u", "ar_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "da", "\\u", "ar_", "=_", "numpy_", "._", "array_", "(_", "data\\u", "list_", ")_", "\\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_", "Modul", "e", "Exception_", "(_", "\"", "Not", " ", "all", " ", "Data", " ", "Array", " ", "inputs", " ", "are", " ", "the", " ", "same", " ", "size", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "da", "\\u", "ar_", "._", "shape_", "[_", "0_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lab_", "=_", "self_", "._", "get", "\\u", "label_", "(_", "data_", "[_", "i_", "]_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col_", "=_", "self_", "._", "get", "\\u", "color_", "(_", "colors_", ",_", "i_", ",_", "random", "colors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "+=_", "'", "hist", "(", "da", "\\u", "ar", "['_", "+_", "str_", "(_", "i_", ")_", "+_", "',", ":]", ",", " ", "bins", "='_", "+_", "str_", "(_", "nbins_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "lab_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", " ", "label", "=\\\\", "''_", "+_", "lab_", "+_", "'\\\\''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "col_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", " ", "face", "color", "='_", "+_", "str_", "(_", "col_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "+=_", "',", " ", "norm", "ed", "='_", "+_", "str_", "(_", "normed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "+=_", "')", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "use", "\\u", "legend_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "legend", "()", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "array", "\\u", "x", "\\u", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "xlabel", "(\\\\'", "'_", "+_", "data_", "[_", "0_", "]_", "._", "get", "\\u", "domain", "\\u", "name_", "(_", ")_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "x", "\\u", "label_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "xlabel", "(\\\\'", "'_", "+_", "x", "\\u", "label_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "array", "\\u", "y", "\\u", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "ylabel", "(\\\\'", "Histogram", " ", "Value", "\\\\')", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "p", "\\u", "title_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "title", "(\\\\'", "'_", "+_", "p", "\\u", "title_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exec_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "source", "\"_", ",_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bar", "Chart_", "(_", "Array", "Plot_", ",_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "self_", "._", "get", "\\u", "input", "\\u", "list_", "(_", "\"", "Data", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "errs_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input", "\\u", "list_", "(_", "\"", "Error", " ", "Bar", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "errs_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errs_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "label", "\\u", "dict_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "color", "\\u", "dict_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "use", "\\u", "legend_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Legend", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "random", "colors_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Random", " ", "Color", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "colors_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input", "\\u", "list_", "(_", "\"", "Color", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bg", "\\u", "color_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Back", "ground", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "array", "\\u", "x", "\\u", "t_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Us", "e", " ", "X", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "array", "\\u", "y", "\\u", "t_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Us", "e", " ", "Y", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ticks_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input", "\\u", "list_", "(_", "\"", "Bar", " ", "Label", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tick", "\\u", "dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "k_", ",_", "v_", ")_", "in_", "ticks_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "tick", "\\u", "dict_", "[_", "k_", "]_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "p", "\\u", "title_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x", "\\u", "label_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "X", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "\\u", "label_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Y", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "width_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Bar", " ", "Wid", "th", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "width_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "width_", "=_", "0.5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "errs_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "data_", ")_", "!=_", "len_", "(_", "errs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Modul", "e", "Error_", "(_", "\"", "Number", " ", "of", " ", "data", " ", "doe", "s", " ", "not", " ", "match", " ", "number", " ", "of", " ", "error", " ", "bar", " ", "data", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "=_", "urllib_", "._", "unquote_", "(_", "str_", "(_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "source", "\"_", ",_", "''_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "source_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "'", "from", " ", "pyla", "b", " ", "import", " ", "*\\\\", "n", "'_", "+_", "'", "from", " ", "nump", "y", " ", "import", " ", "*\\\\", "n", "'_", "+_", "'", "import", " ", "nump", "y", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "bg", "\\u", "color_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bg", "\\u", "color_", "=_", "'", "w", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "type_", "(_", "bg", "\\u", "color_", ")_", "==_", "type_", "(_", "''_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "figure", "(", "face", "color", "=\\\\", "''_", "+_", "bg", "\\u", "color_", "+_", "'\\\\'", ")\\\\", "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 ", " _", "s_", "+=_", "'", "figure", "(", "face", "color", "='_", "+_", "str_", "(_", "bg", "\\u", "color_", ")_", "+_", "')", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "nump", "ts_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ind_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prev_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ind_", "=_", "numpy_", "._", "arange_", "(_", "data_", "[_", "0_", "]_", "._", "get", "\\u", "array_", "(_", ")_", "._", "flatten_", "(_", ")_", "._", "shape_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "self_", "._", "get", "\\u", "ticks_", "(_", "data_", "[_", "0_", "]_", "._", "get", "\\u", "array_", "(_", ")_", "._", "flatten_", "(_", ")_", "._", "shape_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ag", "\\u", "ar_", "=_", "numpy_", "._", "zeros_", "(_", "(_", "len_", "(_", "data_", ")_", ",_", "data_", "[_", "0_", "]_", "._", "get", "\\u", "array_", "(_", ")_", "._", "flatten_", "(_", ")_", "._", "shape_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "data_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "da", "\\u", "ar_", "=_", "data_", "[_", "i_", "]_", "._", "get", "\\u", "array_", "(_", ")_", "._", "flatten_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ag", "\\u", "ar_", "[_", "i_", ",_", ":_", "]_", "=_", "da", "\\u", "ar_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "er", "\\u", "ar_", "=_", "numpy_", "._", "zeros_", "(_", "(_", "len_", "(_", "data_", ")_", ",_", "data_", "[_", "0_", "]_", "._", "get", "\\u", "array_", "(_", ")_", "._", "flatten_", "(_", ")_", "._", "shape_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "errs_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "data_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "er", "\\u", "ar_", "[_", "i_", ",_", ":_", "]_", "=_", "errs_", "[_", "i_", "]_", "._", "get", "\\u", "array_", "(_", ")_", "._", "flatten_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "ag", "\\u", "ar_", "._", "shape_", "[_", "0_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "bar", "(", "ind", ",", " ", "ag", "\\u", "ar", "['_", "+_", "str_", "(_", "i_", ")_", "+_", "',", ":]", ",", " ", "widt", "h", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lab_", "=_", "self_", "._", "get", "\\u", "label_", "(_", "data_", "[_", "i_", "]_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col_", "=_", "self_", "._", "get", "\\u", "color_", "(_", "colors_", ",_", "i_", ",_", "random", "colors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "lab_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", " ", "label", "=\\\\", "''_", "+_", "lab_", "+_", "'\\\\''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "col_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", " ", "color", "='_", "+_", "str_", "(_", "col_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "errs_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", " ", "yer", "r", "=", "er", "\\u", "ar", "['_", "+_", "str_", "(_", "i_", ")_", "+_", "',", ":]", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "prev_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", " ", "bottom", "=", "ag", "\\u", "ar", "['_", "+_", "str_", "(_", "i_", "-_", "1_", ")_", "+_", "',", ":]", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "+=_", "')", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prev_", "=_", "ag", "\\u", "ar_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "use", "\\u", "legend_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "legend", "()", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "array", "\\u", "x", "\\u", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "xlabel", "(\\\\'", "'_", "+_", "data_", "[_", "0_", "]_", "._", "get", "\\u", "domain", "\\u", "name_", "(_", ")_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "x", "\\u", "label_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "xlabel", "(\\\\'", "'_", "+_", "x", "\\u", "label_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "array", "\\u", "y", "\\u", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "ylabel", "(\\\\'", "'_", "+_", "data_", "[_", "0_", "]_", "._", "get", "\\u", "range", "\\u", "name_", "(_", ")_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "y", "\\u", "label_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "ylabel", "(\\\\'", "'_", "+_", "y", "\\u", "label_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "p", "\\u", "title_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "title", "(\\\\'", "'_", "+_", "p", "\\u", "title_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "+=_", "'", "xtick", "s", "(", "ind", " ", "+", " ", "widt", "h", "/", "2", ".,", " ", "t", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exec_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "source", "\"_", ",_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Scatter", "Plot_", "(_", "Array", "Plot_", ",_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xdata_", "=_", "self_", "._", "get", "\\u", "input", "\\u", "list_", "(_", "\"", "X", " ", "Array", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ydata_", "=_", "self_", "._", "get", "\\u", "input", "\\u", "list_", "(_", "\"", "Y", " ", "Array", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "label", "\\u", "dict_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "use", "\\u", "legend_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Legend", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "random", "colors_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Random", " ", "Color", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "colors_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input", "\\u", "list_", "(_", "\"", "Color", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "color", "\\u", "dict_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bg", "\\u", "color_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Back", "ground", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "markers_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input", "\\u", "list_", "(_", "\"", "Markers", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "marker", "\\u", "dict_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ps_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Point", " ", "Size", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "array", "\\u", "x", "\\u", "t_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Us", "e", " ", "X", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "array", "\\u", "y", "\\u", "t_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Us", "e", " ", "Y", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p", "\\u", "title_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x", "\\u", "label_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "X", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "\\u", "label_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Y", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "urllib_", "._", "unquote_", "(_", "str_", "(_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "source", "\"_", ",_", "''_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "source_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "xdata_", ")_", "!=_", "len_", "(_", "ydata_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Modul", "e", "Error_", "(_", "\"", "Cann", "ot", " ", "create", " ", "scatter", " ", "plot", " ", "for", " ", "different", " ", "number", " ", "of", " ", "X", " ", "and", " ", "Y", " ", "dataset", "s", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "=_", "'", "from", " ", "pyla", "b", " ", "import", " ", "*\\\\", "n", "'_", "+_", "'", "from", " ", "nump", "y", " ", "import", " ", "*\\\\", "n", "'_", "+_", "'", "import", " ", "nump", "y", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "bg", "\\u", "color_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bg", "\\u", "color_", "=_", "'", "w", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "type_", "(_", "bg", "\\u", "color_", ")_", "==_", "type_", "(_", "''_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "figure", "(", "face", "color", "=\\\\", "''_", "+_", "bg", "\\u", "color_", "+_", "'\\\\'", ")\\\\", "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 ", " _", "s_", "+=_", "'", "figure", "(", "face", "color", "='_", "+_", "str_", "(_", "bg", "\\u", "color_", ")_", "+_", "')", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xdat", "a", "\\u", "ar_", "=_", "numpy_", "._", "zeros_", "(_", "(_", "len_", "(_", "xdata_", ")_", ",_", "xdata_", "[_", "0_", "]_", "._", "get", "\\u", "array_", "(_", ")_", "._", "flatten_", "(_", ")_", "._", "shape_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yda", "ta", "\\u", "ar_", "=_", "numpy_", "._", "zeros_", "(_", "(_", "len_", "(_", "xdata_", ")_", ",_", "xdata_", "[_", "0_", "]_", "._", "get", "\\u", "array_", "(_", ")_", "._", "flatten_", "(_", ")_", "._", "shape_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "xdata_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xd", "_", "=_", "xdata_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yd", "_", "=_", "ydata_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xdat", "a", "\\u", "ar_", "[_", "i_", ",_", ":_", "]_", "=_", "xd", "_", "._", "get", "\\u", "array_", "(_", ")_", "._", "flatten_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yda", "ta", "\\u", "ar_", "[_", "i_", ",_", ":_", "]_", "=_", "yd", "_", "._", "get", "\\u", "array_", "(_", ")_", "._", "flatten_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "xdata_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xar", "_", "=_", "xdata_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yar", "_", "=_", "ydata_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lab_", "=_", "self_", "._", "get", "\\u", "label_", "(_", "xar", "_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col_", "=_", "self_", "._", "get", "\\u", "color_", "(_", "colors_", ",_", "i_", ",_", "random", "colors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mar", "_", "=_", "self_", "._", "get", "\\u", "marker_", "(_", "markers_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "+=_", "'", "scatter", "(", "xdat", "a", "\\u", "ar", "['_", "+_", "str_", "(_", "i_", ")_", "+_", "',", ":]", ",", " ", "yda", "ta", "\\u", "ar", "['_", "+_", "str_", "(_", "i_", ")_", "+_", "',", ":]", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "lab_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", " ", "label", "=\\\\", "''_", "+_", "lab_", "+_", "'\\\\''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "col_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", " ", "color", "='_", "+_", "str_", "(_", "col_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "mar", "_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", " ", "marker", "=\\\\", "''_", "+_", "mar", "_", "+_", "'\\\\''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ps_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", " ", "size", "='_", "+_", "str_", "(_", "ps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "+=_", "')", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "use", "\\u", "legend_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "legend", "()", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "array", "\\u", "x", "\\u", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "xlabel", "(\\\\'", "'_", "+_", "xar", "_", "._", "get", "\\u", "domain", "\\u", "name_", "(_", ")_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "x", "\\u", "label_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "xlabel", "(\\\\'", "'_", "+_", "x", "\\u", "label_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "array", "\\u", "y", "\\u", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "ylabel", "(\\\\'", "'_", "+_", "yar", "_", "._", "get", "\\u", "domain", "\\u", "name_", "(_", ")_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "y", "\\u", "label_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "ylabel", "(\\\\'", "'_", "+_", "y", "\\u", "label_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "p", "\\u", "title_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "title", "(\\\\'", "'_", "+_", "p", "\\u", "title_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exec_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "source", "\"_", ",_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "Plot_", "(_", "Array", "Plot_", ",_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Inp", "ut", " ", "Array", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "indexes_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Indexe", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "label", "\\u", "dict_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "use", "\\u", "legend_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Legend", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "random", "colors_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Random", " ", "Color", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "colors_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input", "\\u", "list_", "(_", "\"", "Color", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "color", "\\u", "dict_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "markers_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input", "\\u", "list_", "(_", "\"", "Markers", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "marker", "\\u", "dict_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x", "\\u", "label_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "X", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "\\u", "label_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Y", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p", "\\u", "title_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bg", "\\u", "color_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Back", "ground", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "array", "\\u", "x", "\\u", "t_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Us", "e", " ", "X", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "array", "\\u", "y", "\\u", "t_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Us", "e", " ", "Y", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "urllib_", "._", "unquote_", "(_", "str_", "(_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "source", "\"_", ",_", "''_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "source_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "da", "\\u", "ar_", "=_", "data_", "._", "get", "\\u", "array_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "da", "\\u", "ar_", "._", "ndim_", ">_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Modul", "e", "Error_", "(_", "\"", "Cann", "ot", " ", "plot", " ", "data", " ", "with", " ", "dimension", "s", " ", ">", " ", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "=_", "'", "from", " ", "pyla", "b", " ", "import", " ", "*\\\\", "n", "'_", "+_", "'", "from", " ", "nump", "y", " ", "import", " ", "*\\\\", "n", "'_", "+_", "'", "import", " ", "nump", "y", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "bg", "\\u", "color_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bg", "\\u", "color_", "=_", "'", "w", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "type_", "(_", "bg", "\\u", "color_", ")_", "==_", "type_", "(_", "''_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "figure", "(", "face", "color", "=\\\\", "''_", "+_", "bg", "\\u", "color_", "+_", "'\\\\'", ")\\\\", "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 ", " _", "s_", "+=_", "'", "figure", "(", "face", "color", "='_", "+_", "str_", "(_", "bg", "\\u", "color_", ")_", "+_", "')", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "da", "\\u", "ar_", "._", "ndim_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "da", "\\u", "ar_", "._", "shape_", "=_", "(_", "1_", ",_", "da", "\\u", "ar_", "._", "shape_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xar", "_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "X", " ", "Value", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sf_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Sca", "ling", " ", "Factor", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sf_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sf_", "=_", "1._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "xar", "_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "\\u", "i_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "\\u", "i_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "indexes_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "\\u", "i_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "\\u", "i_", "=_", "da", "\\u", "ar_", "._", "shape_", "[_", "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 ", " _", "start", "\\u", "i_", "=_", "indexes_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "\\u", "i_", "=_", "indexes_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xar", "_", "=_", "numpy_", "._", "arange_", "(_", "start", "\\u", "i_", ",_", "end", "\\u", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xar", "_", "=_", "xar", "_", "*_", "sf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xar", "_", "=_", "xar", "_", "._", "get", "\\u", "array_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "da", "\\u", "ar_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "xar", "_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "da", "\\u", "ar_", "._", "shape_", "[_", "0_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lab_", "=_", "self_", "._", "get", "\\u", "label_", "(_", "data_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col_", "=_", "self_", "._", "get", "\\u", "color_", "(_", "colors_", ",_", "i_", ",_", "random", "colors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mar", "_", "=_", "self_", "._", "get", "\\u", "marker_", "(_", "markers_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "indexes_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "plot", "(", "xar", ",", " ", "da", "\\u", "ar", "['_", "+_", "str_", "(_", "i_", ")_", "+_", "',", ":]", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "plot", "(", "xar", ",", " ", "da", "\\u", "ar", "['_", "+_", "str_", "(_", "i_", ")_", "+_", "','_", "+_", "str_", "(_", "indexes_", "[_", "0_", "]_", ")_", "+_", "':'_", "+_", "str_", "(_", "indexes_", "[_", "1_", "]_", ")_", "+_", "']'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "lab_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", " ", "label", "=\\\\", "''_", "+_", "lab_", "+_", "'\\\\''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "col_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", " ", "color", "='_", "+_", "str_", "(_", "col_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "mar", "_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", " ", "marker", "=\\\\", "''_", "+_", "mar", "_", "+_", "'\\\\''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "+=_", "')", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "use", "\\u", "legend_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "legend", "()", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "array", "\\u", "x", "\\u", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "xlabel", "(\\\\'", "'_", "+_", "data_", "._", "get", "\\u", "domain", "\\u", "name_", "(_", ")_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "x", "\\u", "label_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "xlabel", "(\\\\'", "'_", "+_", "x", "\\u", "label_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "array", "\\u", "y", "\\u", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "ylabel", "(\\\\'", "'_", "+_", "data_", "._", "get", "\\u", "range", "\\u", "name_", "(_", ")_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "y", "\\u", "label_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "ylabel", "(\\\\'", "'_", "+_", "y", "\\u", "label_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "p", "\\u", "title_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "title", "(\\\\'", "'_", "+_", "p", "\\u", "title_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exec_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "source", "\"_", ",_", "s_", ")_", "\\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, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
bottlepy/bottle/test/test_mount.py
[ { "content": " def test_mount_wsgi(self):\n status = {}\n def app(environ, start_response):\n start_response('200 OK', [('X-Test', 'WSGI')])\n return 'WSGI ' + environ['PATH_INFO']\n self.app.mount('/test', app)\n self.assertStatus(200, '/test/')\n self.assertBody('WSGI /', '/test')\n self.assertBody('WSGI /', '/test/')\n self.assertHeader('X-Test', 'WSGI', '/test/')\n self.assertBody('WSGI /test/bar', '/test/test/bar')", "metadata": "root.TestAppMounting.test_mount_wsgi", "header": "['class', 'TestAppMounting', '(', 'ServerTestBase', ')', ':', '___EOS___']", "index": 61 }, { "content": " def test_mount_wsgi_ctype_bug(self):\n status = {}\n def app(environ, start_response):\n start_response('200 OK', [('Content-Type', 'test/test')])\n return 'WSGI ' + environ['PATH_INFO']\n self.app.mount('/test', app)\n self.assertHeader('Content-Type', 'test/test', '/test/')", "metadata": "root.TestAppMounting.test_mount_wsgi_ctype_bug", "header": "['class', 'TestAppMounting', '(', 'ServerTestBase', ')', ':', '___EOS___']", "index": 82 } ]
[ { "span": "status ", "start_line": 62, "start_column": 8, "end_line": 62, "end_column": 14 }, { "span": "status ", "start_line": 83, "start_column": 8, "end_line": 83, "end_column": 14 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "App", "Mount", "ing_", "(_", "Server", "Test", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mount", "\\u", "wsgi_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "app_", "(_", "environ_", ",_", "start", "\\u", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "\\u", "response_", "(_", "'", "200", " ", "OK", "'_", ",_", "[_", "(_", "'", "X", "-", "Test", "'_", ",_", "'", "WS", "GI", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'", "WS", "GI", " ", "'_", "+_", "environ_", "[_", "'", "PATH", "\\u", "INFO", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "app_", "._", "mount_", "(_", "'/", "test", "'_", ",_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Status_", "(_", "200_", ",_", "'/", "test", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Body_", "(_", "'", "WS", "GI", " ", "/'_", ",_", "'/", "test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Body_", "(_", "'", "WS", "GI", " ", "/'_", ",_", "'/", "test", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Header_", "(_", "'", "X", "-", "Test", "'_", ",_", "'", "WS", "GI", "'_", ",_", "'/", "test", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Body_", "(_", "'", "WS", "GI", " ", "/", "test", "/", "bar", "'_", ",_", "'/", "test", "/", "test", "/", "bar", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "App", "Mount", "ing_", "(_", "Server", "Test", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mount", "\\u", "wsgi", "\\u", "ctype", "\\u", "bug_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "app_", "(_", "environ_", ",_", "start", "\\u", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "\\u", "response_", "(_", "'", "200", " ", "OK", "'_", ",_", "[_", "(_", "'", "Conten", "t", "-", "Type", "'_", ",_", "'", "test", "/", "test", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'", "WS", "GI", " ", "'_", "+_", "environ_", "[_", "'", "PATH", "\\u", "INFO", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "app_", "._", "mount_", "(_", "'/", "test", "'_", ",_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Header_", "(_", "'", "Conten", "t", "-", "Type", "'_", ",_", "'", "test", "/", "test", "'_", ",_", "'/", "test", "/'_", ")_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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 ]
Unused local variable
xumiao/pymonk/examples/exper.py
[ { "content": "def readModel(filename):\n userFactors = None\n itemFactors = None\n with open(filename) as f:\n modelname = readline(f)\n version = readline(f)\n globalbias = float(readline(f))\n minRate = int(readline(f))\n maxRate = int(readline(f))\n userBias = readVector(f)\n userFactors = readMatrix(f)\n itemBias = readVector(f)\n itemFactors = readMatrix(f)\n return userFactors, itemFactors", "metadata": "root.readModel", "header": "['module', '___EOS___']", "index": 36 } ]
[ { "span": "modelname ", "start_line": 40, "start_column": 8, "end_line": 40, "end_column": 17 }, { "span": "version ", "start_line": 41, "start_column": 8, "end_line": 41, "end_column": 15 }, { "span": "globalbias ", "start_line": 42, "start_column": 8, "end_line": 42, "end_column": 18 }, { "span": "minRate ", "start_line": 43, "start_column": 8, "end_line": 43, "end_column": 15 }, { "span": "maxRate ", "start_line": 44, "start_column": 8, "end_line": 44, "end_column": 15 }, { "span": "userBias ", "start_line": 45, "start_column": 8, "end_line": 45, "end_column": 16 }, { "span": "itemBias ", "start_line": 47, "start_column": 8, "end_line": 47, "end_column": 16 } ]
[]
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_", "read", "Model_", "(_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "Factor", "s_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "item", "Factor", "s_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "filename_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model", "name_", "=_", "readline_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "version_", "=_", "readline_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global", "bias_", "=_", "float_", "(_", "readline_", "(_", "f_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "Rate_", "=_", "int_", "(_", "readline_", "(_", "f_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "Rate_", "=_", "int_", "(_", "readline_", "(_", "f_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "Bia", "s_", "=_", "read", "Vector_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "Factor", "s_", "=_", "read", "Matrix_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "item", "Bia", "s_", "=_", "read", "Vector_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "item", "Factor", "s_", "=_", "read", "Matrix_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "user", "Factor", "s_", ",_", "item", "Factor", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 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, 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 ]
Variable defined multiple times
XiaoMi/minos/owl/collector/management/commands/metrics_updater.py
[ { "content": "def analyze_hbase_master_metrics(metric_task, metrics):\n cluster = metric_task.job.cluster\n hbase_cluster_record, created = HBaseCluster.objects.get_or_create(cluster=cluster)\n reset_aggregated_metrics(hbase_cluster_record)\n tables = {}\n region_record_need_save = []\n for bean in metrics['beans']:\n try:\n if 'RegionServers' not in bean:\n continue\n for rs_metrics in bean['RegionServers']:\n rs_name = rs_metrics['key']\n [rs_hostname, rs_port] = get_host_and_port_from_region_server_name(rs_name)\n rs_task = dbutil.get_task_by_host_and_port(rs_hostname, rs_port)\n rs_record, created = RegionServer.objects.get_or_create(cluster = cluster,\n task = rs_task)\n # region server name includes startTime, which means the same region server\n # will lead different RegionServer records if the region server restarts.\n # Therefore, we won't create region server by its name.\n rs_record.name = rs_name\n\n rs_value = rs_metrics['value']\n rs_record.last_attempt_time = metric_task.last_attempt_time\n rs_record.load = int(rs_value['load'])\n rs_record.numberOfRegions = int(rs_value['numberOfRegions'])\n reset_aggregated_metrics(rs_record)\n\n # we read out all regions belong to this region server and build a map\n all_regions_in_rs = Region.objects.filter(region_server = rs_record)\n all_regions_in_rs = dbutil.get_alive_regions_by_rs(rs_record)\n all_regions_map = {}\n logger.info(\"%r Finish get region: %d\", metric_task, len(all_regions_in_rs))\n for region in all_regions_in_rs:\n all_regions_map[region.name] = region\n\n regionsLoad = rs_value['regionsLoad']\n for region_metrics in regionsLoad:\n region_value = region_metrics['value']\n region_name = region_value['nameAsString']\n try:\n table_name = region_name.split(',')[0]\n except Exception as e:\n logger.warning(\"%r failed to get region name: %r, %s\",\n metric_task, e, region_name)\n continue\n\n region_metrics = {}\n\n if table_name not in tables:\n table_record, created = Table.objects.get_or_create(cluster = cluster,\n name = table_name)\n reset_aggregated_metrics(table_record)\n tables[table_name] = table_record\n\n table_record = tables[table_name]\n\n region_record = None\n if region_name in all_regions_map:\n region_record = all_regions_map[region_name]\n else:\n # if region record not in buffer, we get_or_create from db\n begin = datetime.datetime.now()\n region_record, created = Region.objects.get_or_create(table = table_record,\n name = region_name, encodeName = Region.get_encode_name(region_name),\n defaults={\"region_server\":rs_record})\n logger.info(\"%r get_or_create region in region_server from mysql, \" \\\n \"consume=%s, region_name=%s, buffered_rs=%s, get_rs=%s\",\n metric_task, str((datetime.datetime.now() - begin).total_seconds()),\n region_name, rs_record.name, region_record.region_server.name)\n\n\n logger.info(\"%r Finish analyze regionsLoad\", metric_task)\n\n region_record.region_server = rs_record\n region_record.analyze_region_record(region_value,\n metric_task.last_attempt_time)\n # we buffer the regions needed update for batch update\n region_record_need_save.append(region_record)\n aggregate_metrics(region_record, rs_record)\n aggregate_metrics(region_record, table_record)\n aggregate_metrics(region_record, hbase_cluster_record)\n\n rs_record.save()\n\n for table_record in tables.itervalues():\n table_record.last_attempt_time = metric_task.last_attempt_time\n table_record.availability = dbutil.getTableAvailability(\n table_record.cluster.name, table_record.name)\n table_record.save()\n\n hbase_cluster_record.save()\n\n # do batch update\n begin = datetime.datetime.now()\n dbutil.update_regions_for_master_metrics(region_record_need_save)\n logger.info(\"%r batch save region record for master, \" \\\n \"saved regions=%d, consume=%s\",\n metric_task, len(region_record_need_save),\n str((datetime.datetime.now() - begin).total_seconds()))\n except Exception as e:\n traceback.print_exc()\n logger.warning(\"%r failed to analyze metrics: %r\", metric_task, e)\n continue", "metadata": "root.analyze_hbase_master_metrics", "header": "['module', '___EOS___']", "index": 126 } ]
[ { "span": "all_regions_in_rs ", "start_line": 154, "start_column": 8, "end_line": 154, "end_column": 25 } ]
[ { "span": "all_regions_in_rs ", "start_line": 155, "start_column": 8, "end_line": 155, "end_column": 25 } ]
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_", "analyze", "\\u", "hbase", "\\u", "master", "\\u", "metrics_", "(_", "metric", "\\u", "task_", ",_", "metrics_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cluster_", "=_", "metric", "\\u", "task_", "._", "job_", "._", "cluster_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hbase", "\\u", "cluster", "\\u", "record_", ",_", "created_", "=_", "HB", "ase", "Cluster_", "._", "objects_", "._", "get", "\\u", "or", "\\u", "create_", "(_", "cluster_", "=_", "cluster_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reset", "\\u", "aggregated", "\\u", "metrics_", "(_", "hbase", "\\u", "cluster", "\\u", "record_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tables_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "region", "\\u", "record", "\\u", "need", "\\u", "save_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "bean", "_", "in_", "metrics_", "[_", "'", "beans", "'_", "]_", ":_", "\\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_", "'", "Region", "Server", "s", "'_", "not_", "in_", "bean", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "rs", "\\u", "metrics_", "in_", "bean", "_", "[_", "'", "Region", "Server", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rs", "\\u", "name_", "=_", "rs", "\\u", "metrics_", "[_", "'", "key", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[_", "rs", "\\u", "hostname_", ",_", "rs", "\\u", "port_", "]_", "=_", "get", "\\u", "host", "\\u", "and", "\\u", "port", "\\u", "from", "\\u", "region", "\\u", "server", "\\u", "name_", "(_", "rs", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rs", "\\u", "task_", "=_", "dbu", "til_", "._", "get", "\\u", "task", "\\u", "by", "\\u", "host", "\\u", "and", "\\u", "port_", "(_", "rs", "\\u", "hostname_", ",_", "rs", "\\u", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rs", "\\u", "record_", ",_", "created_", "=_", "Region", "Server_", "._", "objects_", "._", "get", "\\u", "or", "\\u", "create_", "(_", "cluster_", "=_", "cluster_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "task_", "=_", "rs", "\\u", "task_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "region", " ", "server", " ", "name", " ", "include", "s", " ", "start", "Time", ",", " ", "whi", "ch", " ", "means", " ", "the", " ", "same", " ", "region", " ", "server_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "will", " ", "lead", " ", "different", " ", "Region", "Server", " ", "record", "s", " ", "if", " ", "the", " ", "region", " ", "server", " ", "restart", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "There", "fore", ",", " ", "we", " ", "won", "'", "t", " ", "create", " ", "region", " ", "server", " ", "by", " ", "its", " ", "name", "._", "\\u\\u\\uNL\\u\\u\\u_", "rs", "\\u", "record_", "._", "name_", "=_", "rs", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rs", "\\u", "value_", "=_", "rs", "\\u", "metrics_", "[_", "'", "value", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rs", "\\u", "record_", "._", "last", "\\u", "atte", "mpt", "\\u", "time_", "=_", "metric", "\\u", "task_", "._", "last", "\\u", "atte", "mpt", "\\u", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rs", "\\u", "record_", "._", "load_", "=_", "int_", "(_", "rs", "\\u", "value_", "[_", "'", "load", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rs", "\\u", "record_", "._", "number", "Of", "Regions", "_", "=_", "int_", "(_", "rs", "\\u", "value_", "[_", "'", "number", "Of", "Regions", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reset", "\\u", "aggregated", "\\u", "metrics_", "(_", "rs", "\\u", "record_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "read", " ", "out", " ", "all", " ", "regions", " ", "belo", "ng", " ", "to", " ", "this", " ", "region", " ", "server", " ", "and", " ", "build", " ", "a", " ", "map_", "\\u\\u\\uNL\\u\\u\\u_", "all", "\\u", "regions", "\\u", "in", "\\u", "rs_", "=_", "Region_", "._", "objects_", "._", "filter_", "(_", "region", "\\u", "server_", "=_", "rs", "\\u", "record_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "regions", "\\u", "in", "\\u", "rs_", "=_", "dbu", "til_", "._", "get", "\\u", "alive", "\\u", "regions", "\\u", "by", "\\u", "rs_", "(_", "rs", "\\u", "record_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "regions", "\\u", "map_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"%", "r", " ", "Finish", " ", "get", " ", "region", ":", " ", "%", "d", "\"_", ",_", "metric", "\\u", "task_", ",_", "len_", "(_", "all", "\\u", "regions", "\\u", "in", "\\u", "rs_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "region_", "in_", "all", "\\u", "regions", "\\u", "in", "\\u", "rs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "all", "\\u", "regions", "\\u", "map_", "[_", "region_", "._", "name_", "]_", "=_", "region_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "regions", "Load_", "=_", "rs", "\\u", "value_", "[_", "'", "regions", "Load", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "region", "\\u", "metrics_", "in_", "regions", "Load_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "region", "\\u", "value_", "=_", "region", "\\u", "metrics_", "[_", "'", "value", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "region", "\\u", "name_", "=_", "region", "\\u", "value_", "[_", "'", "name", "As", "String", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table", "\\u", "name_", "=_", "region", "\\u", "name_", "._", "split_", "(_", "','_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "warning_", "(_", "\"%", "r", " ", "fail", "ed", " ", "to", " ", "get", " ", "region", " ", "name", ":", " ", "%", "r", ",", " ", "%", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metric", "\\u", "task_", ",_", "e_", ",_", "region", "\\u", "name_", ")_", "\\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_", "region", "\\u", "metrics_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "table", "\\u", "name_", "not_", "in_", "tables_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table", "\\u", "record_", ",_", "created_", "=_", "Table_", "._", "objects_", "._", "get", "\\u", "or", "\\u", "create_", "(_", "cluster_", "=_", "cluster_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "table", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reset", "\\u", "aggregated", "\\u", "metrics_", "(_", "table", "\\u", "record_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tables_", "[_", "table", "\\u", "name_", "]_", "=_", "table", "\\u", "record_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "table", "\\u", "record_", "=_", "tables_", "[_", "table", "\\u", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "region", "\\u", "record_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "region", "\\u", "name_", "in_", "all", "\\u", "regions", "\\u", "map_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "region", "\\u", "record_", "=_", "all", "\\u", "regions", "\\u", "map_", "[_", "region", "\\u", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "region", " ", "record", " ", "not", " ", "in", " ", "buffer", ",", " ", "we", " ", "get", "\\u", "or", "\\u", "create", " ", "from", " ", "db_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "begin_", "=_", "datetime_", "._", "datetime_", "._", "now_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "region", "\\u", "record_", ",_", "created_", "=_", "Region_", "._", "objects_", "._", "get", "\\u", "or", "\\u", "create_", "(_", "table_", "=_", "table", "\\u", "record_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "region", "\\u", "name_", ",_", "encode", "Name_", "=_", "Region_", "._", "get", "\\u", "encode", "\\u", "name_", "(_", "region", "\\u", "name_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "defaults_", "=_", "{_", "\"", "region", "\\u", "server", "\"_", ":_", "rs", "\\u", "record_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"%", "r", " ", "get", "\\u", "or", "\\u", "create", " ", "region", " ", "in", " ", "region", "\\u", "server", " ", "from", " ", "mysql", ",", " ", "\"_", "\"", "consume", "=", "%", "s", ",", " ", "region", "\\u", "name", "=", "%", "s", ",", " ", "buffered", "\\u", "rs", "=", "%", "s", ",", " ", "get", "\\u", "rs", "=", "%", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metric", "\\u", "task_", ",_", "str_", "(_", "(_", "datetime_", "._", "datetime_", "._", "now_", "(_", ")_", "-_", "begin_", ")_", "._", "total", "\\u", "seconds_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "region", "\\u", "name_", ",_", "rs", "\\u", "record_", "._", "name_", ",_", "region", "\\u", "record_", "._", "region", "\\u", "server_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"%", "r", " ", "Finish", " ", "analyze", " ", "regions", "Load", "\"_", ",_", "metric", "\\u", "task_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "region", "\\u", "record_", "._", "region", "\\u", "server_", "=_", "rs", "\\u", "record_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "region", "\\u", "record_", "._", "analyze", "\\u", "region", "\\u", "record_", "(_", "region", "\\u", "value_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metric", "\\u", "task_", "._", "last", "\\u", "atte", "mpt", "\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", " ", "buffer", " ", "the", " ", "regions", " ", "need", "ed", " ", "update", " ", "for", " ", "batch", " ", "update_", "\\u\\u\\uNL\\u\\u\\u_", "region", "\\u", "record", "\\u", "need", "\\u", "save_", "._", "append_", "(_", "region", "\\u", "record_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aggre", "gate", "\\u", "metrics_", "(_", "region", "\\u", "record_", ",_", "rs", "\\u", "record_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aggre", "gate", "\\u", "metrics_", "(_", "region", "\\u", "record_", ",_", "table", "\\u", "record_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aggre", "gate", "\\u", "metrics_", "(_", "region", "\\u", "record_", ",_", "hbase", "\\u", "cluster", "\\u", "record_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rs", "\\u", "record_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "table", "\\u", "record_", "in_", "tables_", "._", "itervalues_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table", "\\u", "record_", "._", "last", "\\u", "atte", "mpt", "\\u", "time_", "=_", "metric", "\\u", "task_", "._", "last", "\\u", "atte", "mpt", "\\u", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table", "\\u", "record_", "._", "availability_", "=_", "dbu", "til_", "._", "get", "Table", "Avail", "ability_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "table", "\\u", "record_", "._", "cluster_", "._", "name_", ",_", "table", "\\u", "record_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table", "\\u", "record_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "hbase", "\\u", "cluster", "\\u", "record_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "do", " ", "batch", " ", "update_", "\\u\\u\\uNL\\u\\u\\u_", "begin_", "=_", "datetime_", "._", "datetime_", "._", "now_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbu", "til_", "._", "update", "\\u", "regions", "\\u", "for", "\\u", "master", "\\u", "metrics_", "(_", "region", "\\u", "record", "\\u", "need", "\\u", "save_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"%", "r", " ", "batch", " ", "save", " ", "region", " ", "record", " ", "for", " ", "master", ",", " ", "\"_", "\"", "saved", " ", "regions", "=", "%", "d", ",", " ", "consume", "=", "%", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metric", "\\u", "task_", ",_", "len_", "(_", "region", "\\u", "record", "\\u", "need", "\\u", "save_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "(_", "(_", "datetime_", "._", "datetime_", "._", "now_", "(_", ")_", "-_", "begin_", ")_", "._", "total", "\\u", "seconds_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "traceback_", "._", "print", "\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "warning_", "(_", "\"%", "r", " ", "fail", "ed", " ", "to", " ", "analyze", " ", "metric", "s", ":", " ", "%", "r", "\"_", ",_", "metric", "\\u", "task_", ",_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\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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"from functools import wraps\nimport os\nimport pkgutil\nfrom threading import local\nimport warnings\n\nfrom django.conf import settings\nfrom django.core.exceptions import ImproperlyConfigured\nfrom django.utils.functional import cached_property\nfrom django.utils.importlib import import_module\nfrom django.utils.module_loading import import_by_path\nfrom django.utils._os import upath\nfrom django.utils import six\n\n\nDEFAULT_DB_ALIAS = 'default'\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", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Error(Exception if six.PY3 else StandardError):\n pass", "metadata": "root.Error", "header": "['module', '___EOS___']", "index": 18 }, { "content": "class InterfaceError(Error):\n pass", "metadata": "root.InterfaceError", "header": "['module', '___EOS___']", "index": 22 }, { "content": "class DatabaseError(Error):\n pass", "metadata": "root.DatabaseError", "header": "['module', '___EOS___']", "index": 26 }, { "content": "class DataError(DatabaseError):\n pass", "metadata": "root.DataError", "header": "['module', '___EOS___']", "index": 30 }, { "content": "class OperationalError(DatabaseError):\n pass", "metadata": "root.OperationalError", "header": "['module', '___EOS___']", "index": 34 }, { "content": "class IntegrityError(DatabaseError):\n pass", "metadata": "root.IntegrityError", "header": "['module', '___EOS___']", "index": 38 }, { "content": "class InternalError(DatabaseError):\n pass", "metadata": "root.InternalError", "header": "['module', '___EOS___']", "index": 42 }, { "content": "class ProgrammingError(DatabaseError):\n pass", "metadata": "root.ProgrammingError", "header": "['module', '___EOS___']", "index": 46 }, { "content": "class NotSupportedError(DatabaseError):\n pass", "metadata": "root.NotSupportedError", "header": "['module', '___EOS___']", "index": 50 }, { "content": "class DatabaseErrorWrapper(object):\n \"\"\"\n Context manager and decorator that re-throws backend-specific database\n exceptions using Django's common wrappers.\n \"\"\"\n\n\n\n", "metadata": "root.DatabaseErrorWrapper", "header": "['module', '___EOS___']", "index": 54 }, { "content": " def __init__(self, wrapper):\n \"\"\"\n wrapper is a database wrapper.\n\n It must have a Database attribute defining PEP-249 exceptions.\n \"\"\"\n self.wrapper = wrapper", "metadata": "root.DatabaseErrorWrapper.__init__", "header": "['class', 'DatabaseErrorWrapper', '(', 'object', ')', ':', '___EOS___']", "index": 60 }, { "content": " def __enter__(self):\n pass", "metadata": "root.DatabaseErrorWrapper.__enter__", "header": "['class', 'DatabaseErrorWrapper', '(', 'object', ')', ':', '___EOS___']", "index": 68 }, { "content": " def __exit__(self, exc_type, exc_value, traceback):\n if exc_type is None:\n return\n for dj_exc_type in (\n DataError,\n OperationalError,\n IntegrityError,\n InternalError,\n ProgrammingError,\n NotSupportedError,\n DatabaseError,\n InterfaceError,\n Error,\n ):\n db_exc_type = getattr(self.wrapper.Database, dj_exc_type.__name__)\n if issubclass(exc_type, db_exc_type):\n # Under Python 2.6, exc_value can still be a string.\n try:\n args = tuple(exc_value.args)\n except AttributeError:\n args = (exc_value,)\n dj_exc_value = dj_exc_type(*args)\n dj_exc_value.__cause__ = exc_value\n # Only set the 'errors_occurred' flag for errors that may make\n # the connection unusable.\n if dj_exc_type not in (DataError, IntegrityError):\n self.wrapper.errors_occurred = True\n six.reraise(dj_exc_type, dj_exc_value, traceback)", "metadata": "root.DatabaseErrorWrapper.__exit__", "header": "['class', 'DatabaseErrorWrapper', '(', 'object', ')', ':', '___EOS___']", "index": 71 }, { "content": " def __call__(self, func):\n # Note that we are intentionally not using @wraps here for performance\n # reasons. Refs #21109.\n def inner(*args, **kwargs):\n with self:\n return func(*args, **kwargs)\n return inner", "metadata": "root.DatabaseErrorWrapper.__call__", "header": "['class', 'DatabaseErrorWrapper', '(', 'object', ')', ':', '___EOS___']", "index": 100 }, { "content": "def load_backend(backend_name):\n # Look for a fully qualified database backend name\n try:\n return import_module('%s.base' % backend_name)\n except ImportError as e_user:\n # The database backend wasn't found. Display a helpful error message\n # listing all possible (built-in) database backends.\n backend_dir = os.path.join(os.path.dirname(upath(__file__)), 'backends')\n try:\n builtin_backends = [\n name for _, name, ispkg in pkgutil.iter_modules([backend_dir])\n if ispkg and name != 'dummy']\n except EnvironmentError:\n builtin_backends = []\n if backend_name not in ['django.db.backends.%s' % b for b in\n builtin_backends]:\n backend_reprs = map(repr, sorted(builtin_backends))\n error_msg = (\"%r isn't an available database backend.\\n\"\n \"Try using 'django.db.backends.XXX', where XXX \"\n \"is one of:\\n %s\\nError was: %s\" %\n (backend_name, \", \".join(backend_reprs), e_user))\n raise ImproperlyConfigured(error_msg)\n else:\n # If there's some other error, this must be an error in Django\n raise", "metadata": "root.load_backend", "header": "['module', '___EOS___']", "index": 109 }, { "content": "class ConnectionDoesNotExist(Exception):\n pass", "metadata": "root.ConnectionDoesNotExist", "header": "['module', '___EOS___']", "index": 136 }, { "content": "class ConnectionHandler(object):\n\n\n\n\n\n\n", "metadata": "root.ConnectionHandler", "header": "['module', '___EOS___']", "index": 140 }, { "content": " def __init__(self, databases=None):\n \"\"\"\n databases is an optional dictionary of database definitions (structured\n like settings.DATABASES).\n \"\"\"\n self._databases = databases\n self._connections = local()", "metadata": "root.ConnectionHandler.__init__", "header": "['class', 'ConnectionHandler', '(', 'object', ')', ':', '___EOS___']", "index": 141 }, { "content": " @cached_property\n def databases(self):\n if self._databases is None:\n self._databases = settings.DATABASES\n if self._databases == {}:\n self._databases = {\n DEFAULT_DB_ALIAS: {\n 'ENGINE': 'django.db.backends.dummy',\n },\n }\n if DEFAULT_DB_ALIAS not in self._databases:\n raise ImproperlyConfigured(\"You must define a '%s' database\" % DEFAULT_DB_ALIAS)\n return self._databases", "metadata": "root.ConnectionHandler.databases", "header": "['class', 'ConnectionHandler', '(', 'object', ')', ':', '___EOS___']", "index": 149 }, { "content": " def ensure_defaults(self, alias):\n \"\"\"\n Puts the defaults into the settings dictionary for a given connection\n where no settings is provided.\n \"\"\"\n try:\n conn = self.databases[alias]\n except KeyError:\n raise ConnectionDoesNotExist(\"The connection %s doesn't exist\" % alias)\n\n conn.setdefault('ATOMIC_REQUESTS', False)\n if settings.TRANSACTIONS_MANAGED:\n warnings.warn(\n \"TRANSACTIONS_MANAGED is deprecated. Use AUTOCOMMIT instead.\",\n PendingDeprecationWarning, stacklevel=2)\n conn.setdefault('AUTOCOMMIT', False)\n conn.setdefault('AUTOCOMMIT', True)\n conn.setdefault('ENGINE', 'django.db.backends.dummy')\n if conn['ENGINE'] == 'django.db.backends.' or not conn['ENGINE']:\n conn['ENGINE'] = 'django.db.backends.dummy'\n conn.setdefault('CONN_MAX_AGE', 0)\n conn.setdefault('OPTIONS', {})\n conn.setdefault('TIME_ZONE', 'UTC' if settings.USE_TZ else settings.TIME_ZONE)\n for setting in ['NAME', 'USER', 'PASSWORD', 'HOST', 'PORT']:\n conn.setdefault(setting, '')\n for setting in ['TEST_CHARSET', 'TEST_COLLATION', 'TEST_NAME', 'TEST_MIRROR']:\n conn.setdefault(setting, None)", "metadata": "root.ConnectionHandler.ensure_defaults", "header": "['class', 'ConnectionHandler', '(', 'object', ')', ':', '___EOS___']", "index": 163 }, { "content": " def __getitem__(self, alias):\n if hasattr(self._connections, alias):\n return getattr(self._connections, alias)\n\n self.ensure_defaults(alias)\n db = self.databases[alias]\n backend = load_backend(db['ENGINE'])\n conn = backend.DatabaseWrapper(db, alias)\n setattr(self._connections, alias, conn)\n return conn", "metadata": "root.ConnectionHandler.__getitem__", "header": "['class', 'ConnectionHandler', '(', 'object', ')', ':', '___EOS___']", "index": 191 }, { "content": " def __setitem__(self, key, value):\n setattr(self._connections, key, value)", "metadata": "root.ConnectionHandler.__setitem__", "header": "['class', 'ConnectionHandler', '(', 'object', ')', ':', '___EOS___']", "index": 202 }, { "content": " def __delitem__(self, key):\n delattr(self._connections, key)", "metadata": "root.ConnectionHandler.__delitem__", "header": "['class', 'ConnectionHandler', '(', 'object', ')', ':', '___EOS___']", "index": 205 }, { "content": " def __iter__(self):\n return iter(self.databases)", "metadata": "root.ConnectionHandler.__iter__", "header": "['class', 'ConnectionHandler', '(', 'object', ')', ':', '___EOS___']", "index": 208 }, { "content": " def all(self):\n return [self[alias] for alias in self]", "metadata": "root.ConnectionHandler.all", "header": "['class', 'ConnectionHandler', '(', 'object', ')', ':', '___EOS___']", "index": 211 }, { "content": "class ConnectionRouter(object):\n\n\n\n db_for_read = _router_func('db_for_read')\n db_for_write = _router_func('db_for_write')\n\n", "metadata": "root.ConnectionRouter", "header": "['module', '___EOS___']", "index": 215 }, { "content": " def __init__(self, routers=None):\n \"\"\"\n If routers is not specified, will default to settings.DATABASE_ROUTERS.\n \"\"\"\n self._routers = routers", "metadata": "root.ConnectionRouter.__init__", "header": "['class', 'ConnectionRouter', '(', 'object', ')', ':', '___EOS___']", "index": 216 }, { "content": " @cached_property\n def routers(self):\n if self._routers is None:\n self._routers = settings.DATABASE_ROUTERS\n routers = []\n for r in self._routers:\n if isinstance(r, six.string_types):\n router = import_by_path(r)()\n else:\n router = r\n routers.append(router)\n return routers", "metadata": "root.ConnectionRouter.routers", "header": "['class', 'ConnectionRouter', '(', 'object', ')', ':', '___EOS___']", "index": 222 }, { "content": " def _router_func(action):\n def _route_db(self, model, **hints):\n chosen_db = None\n for router in self.routers:\n try:\n method = getattr(router, action)\n except AttributeError:\n # If the router doesn't have a method, skip to the next one.\n pass\n else:\n chosen_db = method(model, **hints)\n if chosen_db:\n return chosen_db\n try:\n return hints['instance']._state.db or DEFAULT_DB_ALIAS\n except KeyError:\n return DEFAULT_DB_ALIAS\n return _route_db", "metadata": "root.ConnectionRouter._router_func", "header": "['class', 'ConnectionRouter', '(', 'object', ')', ':', '___EOS___']", "index": 235 }, { "content": " def allow_relation(self, obj1, obj2, **hints):\n for router in self.routers:\n try:\n method = router.allow_relation\n except AttributeError:\n # If the router doesn't have a method, skip to the next one.\n pass\n else:\n allow = method(obj1, obj2, **hints)\n if allow is not None:\n return allow\n return obj1._state.db == obj2._state.db", "metadata": "root.ConnectionRouter.allow_relation", "header": "['class', 'ConnectionRouter', '(', 'object', ')', ':', '___EOS___']", "index": 257 }, { "content": " def allow_syncdb(self, db, model):\n for router in self.routers:\n try:\n method = router.allow_syncdb\n except AttributeError:\n # If the router doesn't have a method, skip to the next one.\n pass\n else:\n allow = method(db, model)\n if allow is not None:\n return allow\n return True", "metadata": "root.ConnectionRouter.allow_syncdb", "header": "['class', 'ConnectionRouter', '(', 'object', ')', ':', '___EOS___']", "index": 270 } ]
[ { "span": "from functools import wraps", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 27 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "functools_", "import_", "wraps_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pkg", "util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "threading_", "import_", "local_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "warnings_", "\\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_", "._", "core_", "._", "exceptions_", "import_", "Impro", "perl", "y", "Configured_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "functional_", "import_", "cache", "d\\u", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "importlib_", "import_", "import", "\\u", "module_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "module", "\\u", "loading_", "import_", "import", "\\u", "by", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "\\u", "os_", "import_", "upa", "th_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "import_", "six_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "DB", "\\u", "ALIAS_", "=_", "'", "default", "'_", "\\u\\u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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_", "Error_", "(_", "Exception_", "if_", "six_", "._", "PY", "3_", "else_", "Standard", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Interface", "Error_", "(_", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Databa", "se", "Error_", "(_", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Data", "Error_", "(_", "Databa", "se", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Opera", "tion", "al", "Error_", "(_", "Databa", "se", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Int", "egr", "it", "y", "Error_", "(_", "Databa", "se", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Intern", "al", "Error_", "(_", "Databa", "se", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Programm", "ing", "Error_", "(_", "Databa", "se", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Not", "Supp", "orte", "d", "Error_", "(_", "Databa", "se", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Databa", "se", "Error", "Wrapper_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Context", " ", "manage", "r", " ", "and", " ", "decorat", "or", " ", "tha", "t", " ", "re", "-", "throw", "s", " ", "back", "end", "-", "specific", " ", "databa", "se", "\\", "10", ";", " ", " ", " ", " ", "exception", "s", " ", "usi", "ng", " ", "Dj", "ang", "o", "'", "s", " ", "common", " ", "wrapp", "ers", ".", "\\", "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_", "Databa", "se", "Error", "Wrapper_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "wrapper_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "wrapp", "er", " ", "is", " ", "a", " ", "databa", "se", " ", "wrapp", "er", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "It", " ", "must", " ", "have", " ", "a", " ", "Databa", "se", " ", "attribute", " ", "defini", "ng", " ", "PE", "P", "-", "249", " ", "exception", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wrapper_", "=_", "wrapper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Databa", "se", "Error", "Wrapper_", "(_", "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 ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Databa", "se", "Error", "Wrapper_", "(_", "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", "value_", ",_", "traceback_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "exc", "\\u", "type_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "dj", "\\u", "exc", "\\u", "type_", "in_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Data", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Opera", "tion", "al", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Int", "egr", "it", "y", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Intern", "al", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Programm", "ing", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Not", "Supp", "orte", "d", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Databa", "se", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Interface", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db", "\\u", "exc", "\\u", "type_", "=_", "getattr_", "(_", "self_", "._", "wrapper_", "._", "Database_", ",_", "dj", "\\u", "exc", "\\u", "type_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "issubclass_", "(_", "exc", "\\u", "type_", ",_", "db", "\\u", "exc", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Under", " ", "Pyth", "on", " ", "2.6", ",", " ", "exc", "\\u", "value", " ", "can", " ", "still", " ", "be", " ", "a", " ", "string", "._", "\\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 ", " ", "_", "args_", "=_", "tuple_", "(_", "exc", "\\u", "value_", "._", "args_", ")_", "\\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 ", " ", "_", "args_", "=_", "(_", "exc", "\\u", "value_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dj", "\\u", "exc", "\\u", "value_", "=_", "dj", "\\u", "exc", "\\u", "type_", "(_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dj", "\\u", "exc", "\\u", "value_", "._", "\\u\\u", "caus", "e\\u", "\\u_", "=_", "exc", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "On", "ly", " ", "set", " ", "the", " ", "'", "error", "s", "\\u", "occur", "red", "'", " ", "flag", " ", "for", " ", "error", "s", " ", "tha", "t", " ", "may", " ", "make_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "connecti", "on", " ", "unu", "sab", "le", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "dj", "\\u", "exc", "\\u", "type_", "not_", "in_", "(_", "Data", "Error_", ",_", "Int", "egr", "it", "y", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "wrapper_", "._", "error", "s", "\\u", "occur", "red_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "six_", "._", "reraise", "_", "(_", "dj", "\\u", "exc", "\\u", "type_", ",_", "dj", "\\u", "exc", "\\u", "value_", ",_", "traceback_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Databa", "se", "Error", "Wrapper_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "call\\u\\u_", "(_", "self_", ",_", "func_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Not", "e", " ", "tha", "t", " ", "we", " ", "are", " ", "intent", "ional", "ly", " ", "not", " ", "usi", "ng", " ", "@", "wrap", "s", " ", "here", " ", "for", " ", "performance_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "reasons", ".", " ", "Refs", " ", "#", "2110", "9._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "inner_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "func_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "inner_", "\\u\\u\\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_", "load", "\\u", "backend_", "(_", "back", "end", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Look", " ", "for", " ", "a", " ", "full", "y", " ", "qualified", " ", "databa", "se", " ", "back", "end", " ", "name_", "\\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 ", " _", "return_", "import", "\\u", "module_", "(_", "'%", "s", ".", "base", "'_", "%_", "back", "end", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", "as_", "e\\u", "user_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "databa", "se", " ", "back", "end", " ", "was", "n", "'", "t", " ", "found", ".", " ", "Display", " ", "a", " ", "help", "ful", " ", "error", " ", "message_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "listi", "ng", " ", "all", " ", "possib", "le", " ", "(", "bui", "lt", "-", "in", ")", " ", "databa", "se", " ", "back", "ends", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "back", "end", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "upa", "th_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", ",_", "'", "back", "ends", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bui", "lti", "n", "\\u", "backends_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "for_", "\\u_", ",_", "name_", ",_", "isp", "kg_", "in_", "pkg", "util_", "._", "iter", "\\u", "modules_", "(_", "[_", "back", "end", "\\u", "dir_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isp", "kg_", "and_", "name_", "!=_", "'", "dummy", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Environ", "ment", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bui", "lti", "n", "\\u", "backends_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "back", "end", "\\u", "name_", "not_", "in_", "[_", "'", "django", ".", "db", ".", "back", "ends", ".", "%", "s", "'_", "%_", "b_", "for_", "b_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "bui", "lti", "n", "\\u", "backends_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "back", "end", "\\u", "repr", "s_", "=_", "map_", "(_", "repr_", ",_", "sorted_", "(_", "bui", "lti", "n", "\\u", "backends_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error", "\\u", "msg_", "=_", "(_", "\"%", "r", " ", "isn", "'", "t", " ", "an", " ", "avail", "able", " ", "databa", "se", " ", "back", "end", ".\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Tr", "y", " ", "usi", "ng", " ", "'", "django", ".", "db", ".", "back", "ends", ".", "XX", "X", "',", " ", "where", " ", "XX", "X", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "is", " ", "one", " ", "of", ":\\\\", "n", " ", " ", " ", " ", "%", "s", "\\\\", "n", "Error", " ", "was", ":", " ", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "back", "end", "\\u", "name_", ",_", "\",", " ", "\"_", "._", "join_", "(_", "back", "end", "\\u", "repr", "s_", ")_", ",_", "e\\u", "user_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Impro", "perl", "y", "Configured_", "(_", "error", "\\u", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "there", "'", "s", " ", "some", " ", "other", " ", "error", ",", " ", "this", " ", "must", " ", "be", " ", "an", " ", "error", " ", "in", " ", "Dj", "ang", "o_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Connect", "ion", "Do", "es", "Not", "Exist_", "(_", "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_", "Connect", "ion", "Handler_", "(_", "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_", "[SEP]_", "class_", "Connect", "ion", "Handler_", "(_", "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_", ",_", "databases_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "databa", "ses", " ", "is", " ", "an", " ", "option", "al", " ", "dictionar", "y", " ", "of", " ", "databa", "se", " ", "definit", "ion", "s", " ", "(", "structure", "d", "\\", "10", ";", " ", " ", " ", " ", "like", " ", "settings", ".", "DATA", "BASE", "S", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "databases_", "=_", "databases_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "connections_", "=_", "local_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Connect", "ion", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "cache", "d\\u", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "databases_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "databases_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "databases_", "=_", "settings_", "._", "DATABASES_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "databases_", "==_", "{_", "}_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "databases_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "DB", "\\u", "ALIAS_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ENGINE", "'_", ":_", "'", "django", ".", "db", ".", "back", "ends", ".", "dummy", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "DEF", "AUL", "T", "\\u", "DB", "\\u", "ALIAS_", "not_", "in_", "self_", "._", "\\u", "databases_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Impro", "perl", "y", "Configured_", "(_", "\"", "You", " ", "must", " ", "defin", "e", " ", "a", " ", "'%", "s", "'", " ", "databa", "se", "\"_", "%_", "DEF", "AUL", "T", "\\u", "DB", "\\u", "ALIAS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "databases_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Connect", "ion", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ensure", "\\u", "defaults_", "(_", "self_", ",_", "alias_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Put", "s", " ", "the", " ", "default", "s", " ", "int", "o", " ", "the", " ", "settings", " ", "dictionar", "y", " ", "for", " ", "a", " ", "give", "n", " ", "connecti", "on", "\\", "10", ";", " ", " ", " ", " ", "where", " ", "no", " ", "settings", " ", "is", " ", "provided", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "=_", "self_", "._", "databases_", "[_", "alias_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Connect", "ion", "Do", "es", "Not", "Exist_", "(_", "\"", "The", " ", "connecti", "on", " ", "%", "s", " ", "doe", "sn", "'", "t", " ", "exist", "\"_", "%_", "alias_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "conn_", "._", "setdefault_", "(_", "'", "ATOM", "IC", "\\u", "REQUEST", "S", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "settings_", "._", "TRANSACTION", "S", "\\u", "MANAGE", "D_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warnings_", "._", "warn_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "TRANSACTION", "S", "\\u", "MANAGE", "D", " ", "is", " ", "depre", "cated", ".", " ", "Us", "e", " ", "AUTO", "COMMIT", " ", "inst", "ead", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Pend", "ing", "Dep", "reca", "tion", "Warning_", ",_", "stacklevel_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "setdefault_", "(_", "'", "AUTO", "COMMIT", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "conn_", "._", "setdefault_", "(_", "'", "AUTO", "COMMIT", "'_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "setdefault_", "(_", "'", "ENGINE", "'_", ",_", "'", "django", ".", "db", ".", "back", "ends", ".", "dummy", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "conn_", "[_", "'", "ENGINE", "'_", "]_", "==_", "'", "django", ".", "db", ".", "back", "ends", ".'_", "or_", "not_", "conn_", "[_", "'", "ENGINE", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "[_", "'", "ENGINE", "'_", "]_", "=_", "'", "django", ".", "db", ".", "back", "ends", ".", "dummy", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "conn_", "._", "setdefault_", "(_", "'", "CONN", "\\u", "MAX", "\\u", "AGE", "'_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "setdefault_", "(_", "'", "OPTION", "S", "'_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "setdefault_", "(_", "'", "TIME", "\\u", "ZONE", "'_", ",_", "'", "UT", "C", "'_", "if_", "settings_", "._", "USE", "\\u", "TZ_", "else_", "settings_", "._", "TIME", "\\u", "ZONE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "setting_", "in_", "[_", "'", "NAME", "'_", ",_", "'", "USER", "'_", ",_", "'", "PASS", "WORD", "'_", ",_", "'", "HOST", "'_", ",_", "'", "PORT", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "._", "setdefault_", "(_", "setting_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "setting_", "in_", "[_", "'", "TEST", "\\u", "CHARS", "ET", "'_", ",_", "'", "TEST", "\\u", "COLL", "ATION", "'_", ",_", "'", "TEST", "\\u", "NAME", "'_", ",_", "'", "TEST", "\\u", "MIR", "ROR", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "._", "setdefault_", "(_", "setting_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Connect", "ion", "Handler_", "(_", "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", "getitem\\u\\u_", "(_", "self_", ",_", "alias_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "self_", "._", "\\u", "connections_", ",_", "alias_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "getattr_", "(_", "self_", "._", "\\u", "connections_", ",_", "alias_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "ensure", "\\u", "defaults_", "(_", "alias_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "=_", "self_", "._", "databases_", "[_", "alias_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "backend_", "=_", "load", "\\u", "backend_", "(_", "db_", "[_", "'", "ENGINE", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "=_", "backend_", "._", "Databa", "se", "Wrapper_", "(_", "db_", ",_", "alias_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setattr_", "(_", "self_", "._", "\\u", "connections_", ",_", "alias_", ",_", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "conn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Connect", "ion", "Handler_", "(_", "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_", ",_", "key_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setattr_", "(_", "self_", "._", "\\u", "connections_", ",_", "key_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Connect", "ion", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "delitem\\u\\u_", "(_", "self_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "delattr", "_", "(_", "self_", "._", "\\u", "connections_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Connect", "ion", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "iter\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "iter_", "(_", "self_", "._", "databases_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Connect", "ion", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "all_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "self_", "[_", "alias_", "]_", "for_", "alias_", "in_", "self_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Connect", "ion", "Router_", "(_", "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\\uDEDENT\\u\\u\\u_", "db", "\\u", "for", "\\u", "read_", "=_", "\\u", "router", "\\u", "func_", "(_", "'", "db", "\\u", "for", "\\u", "read", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db", "\\u", "for", "\\u", "write_", "=_", "\\u", "router", "\\u", "func_", "(_", "'", "db", "\\u", "for", "\\u", "write", "'_", ")_", "\\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_", "Connect", "ion", "Router_", "(_", "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_", ",_", "routers_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "router", "s", " ", "is", " ", "not", " ", "specified", ",", " ", "will", " ", "default", " ", "to", " ", "settings", ".", "DATA", "BASE", "\\u", "ROUTER", "S", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "routers_", "=_", "routers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Connect", "ion", "Router_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "cache", "d\\u", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "routers_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "routers_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "routers_", "=_", "settings_", "._", "DATA", "BASE", "\\u", "ROUTER", "S_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "routers_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "r_", "in_", "self_", "._", "\\u", "routers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "r_", ",_", "six_", "._", "string", "\\u", "types_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "router_", "=_", "import", "\\u", "by", "\\u", "path_", "(_", "r_", ")_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "router_", "=_", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "routers_", "._", "append_", "(_", "router_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "routers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Connect", "ion", "Router_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "router", "\\u", "func_", "(_", "action_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "route", "\\u", "db_", "(_", "self_", ",_", "model_", ",_", "**_", "hints_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "chosen", "\\u", "db_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "router_", "in_", "self_", "._", "routers_", ":_", "\\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 ", " ", "_", "method_", "=_", "getattr_", "(_", "router_", ",_", "action_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "router", " ", "doe", "sn", "'", "t", " ", "have", " ", "a", " ", "method", ",", " ", "skip", " ", "to", " ", "the", " ", "next", " ", "one", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "chosen", "\\u", "db_", "=_", "method_", "(_", "model_", ",_", "**_", "hints_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "chosen", "\\u", "db_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "return_", "chosen", "\\u", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "hints_", "[_", "'", "instance", "'_", "]_", "._", "\\u", "state_", "._", "db_", "or_", "DEF", "AUL", "T", "\\u", "DB", "\\u", "ALIAS_", "\\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_", "DEF", "AUL", "T", "\\u", "DB", "\\u", "ALIAS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u", "route", "\\u", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Connect", "ion", "Router_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "allow", "\\u", "relation_", "(_", "self_", ",_", "obj1_", ",_", "obj2_", ",_", "**_", "hints_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "router_", "in_", "self_", "._", "routers_", ":_", "\\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 ", " _", "method_", "=_", "router_", "._", "allow", "\\u", "relation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "router", " ", "doe", "sn", "'", "t", " ", "have", " ", "a", " ", "method", ",", " ", "skip", " ", "to", " ", "the", " ", "next", " ", "one", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "allow_", "=_", "method_", "(_", "obj1_", ",_", "obj2_", ",_", "**_", "hints_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "allow_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "allow_", "\\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_", "obj1_", "._", "\\u", "state_", "._", "db_", "==_", "obj2_", "._", "\\u", "state_", "._", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Connect", "ion", "Router_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "allow", "\\u", "sync", "db_", "(_", "self_", ",_", "db_", ",_", "model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "router_", "in_", "self_", "._", "routers_", ":_", "\\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 ", " _", "method_", "=_", "router_", "._", "allow", "\\u", "sync", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "router", " ", "doe", "sn", "'", "t", " ", "have", " ", "a", " ", "method", ",", " ", "skip", " ", "to", " ", "the", " ", "next", " ", "one", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "allow_", "=_", "method_", "(_", "db_", ",_", "model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "allow_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "allow_", "\\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_", "True_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 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, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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/mayavi/mayavi/mlab.py
[ { "content": "\"\"\"\nmlab: a simple scripting interface to Mayavi2 for 3D plotting.\n\nCan be used inside Mayavi2 itself, in \"ipython --gui=qt\", or in any\napplication with a compatible UI (Qt or wxPython).\n\"\"\"\n\n# Author: Prabhu Ramachandran <[email protected]>\n# Gael Varoquaux <gael dot varoquaux at normalesup dot org>\n# Copyright (c) 2007-2016, Enthought, Inc.\n# License: BSD Style.\n\n\n# Try forcing the use of wx 2.8 before any other import.\nimport sys\nif not 'wx' in sys.modules:\n try:\n from traits.etsconfig.api import ETSConfig\n if ETSConfig.toolkit in ('wx', ''):\n import wxversion\n wxversion.ensureMinimal('2.8')\n except ImportError:\n \"\"\" wxversion not installed \"\"\"\n\n\n# Mayavi imports\nfrom mayavi.tools.camera import view, roll, yaw, pitch, move\nfrom mayavi.tools.figure import figure, clf, gcf, savefig, \\\n draw, sync_camera, close, screenshot\nfrom mayavi.tools.engine_manager import get_engine, show_pipeline, \\\n options, set_engine\nfrom mayavi.tools.show import show\nfrom mayavi.tools.animator import animate\n\n\nfrom .tools.helper_functions import contour3d, test_contour3d, \\\n quiver3d, test_quiver3d, test_quiver3d_2d_data, \\\n points3d, test_points3d, test_molecule, \\\n flow, test_flow, \\\n imshow, test_imshow, \\\n surf, test_surf, mesh, test_mesh, test_simple_surf, \\\n test_mesh_sphere, test_fancy_mesh,\\\n contour_surf, test_contour_surf, \\\n plot3d, test_plot3d, \\\n test_plot3d_anim, test_points3d_anim, test_contour3d_anim,\\\n test_simple_surf_anim, test_flow_anim, test_mesh_sphere_anim, \\\n triangular_mesh, test_triangular_mesh, barchart, \\\n test_barchart, test_mesh_mask_custom_colors\n\n\nfrom .tools.decorations import colorbar, scalarbar, vectorbar, \\\n outline, axes, xlabel, ylabel, zlabel, text, title, \\\n orientation_axes, text3d\n\nfrom .tools import pipeline\n\nfrom .tools.tools import start_recording, stop_recording\n\nif __name__ == \"__main__\":\n import numpy\n\n n_mer, n_long = 6, 11\n pi = numpy.pi\n dphi = pi/1000.0\n phi = numpy.arange(0.0, 2*pi + 0.5*dphi, dphi, 'd')\n mu = phi*n_mer\n x = numpy.cos(mu)*(1+numpy.cos(n_long*mu/n_mer)*0.5)\n y = numpy.sin(mu)*(1+numpy.cos(n_long*mu/n_mer)*0.5)\n z = numpy.sin(n_long*mu/n_mer)*0.5\n\n pl = plot3d(x, y, z, numpy.sin(mu), tube_radius=0.05, colormap='Spectral')\n\n colorbar(orientation='vertical')\n\n t = numpy.linspace(0, 4*numpy.pi, 100)\n cos = numpy.cos\n sin = numpy.sin\n\n x = sin(2*t)\n y = cos(t)\n z = sin(2*t)\n s = sin(t)\n\n pts = points3d(x, y, z, s, colormap=\"YlGnBu\", scale_factor=0.1,\n extent=(-0.3,0.3, -0.3, 0.3, -0.2,0.2))\n\n axes(xlabel='X', ylabel='Y', zlabel='Z')\n outline(pl)\n\n title('Mayavi rocks', height=0.85)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def show_engine():\n \"\"\" This function is deprecated, please use show_pipeline.\n \"\"\"\n import warnings\n warnings.warn('The show_engine function is deprecated, please use'\n 'show_pipeline', stacklevel=2)\n return show_pipeline()", "metadata": "root.show_engine", "header": "['module', '___EOS___']", "index": 34 } ]
[ { "span": "from mayavi.tools.camera import view, roll, yaw, pitch, move", "start_line": 26, "start_column": 0, "end_line": 26, "end_column": 60 }, { "span": "from mayavi.tools.figure import figure, clf, gcf, savefig, \\\n draw, sync_camera, close, screenshot", "start_line": 27, "start_column": 0, "end_line": 28, "end_column": 40 }, { "span": "from mayavi.tools.engine_manager import get_engine, show_pipeline, \\\n options, set_engine", "start_line": 29, "start_column": 0, "end_line": 30, "end_column": 27 }, { "span": "from mayavi.tools.show import show", "start_line": 31, "start_column": 0, "end_line": 31, "end_column": 34 }, { "span": "from mayavi.tools.animator import animate", "start_line": 32, "start_column": 0, "end_line": 32, "end_column": 41 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "mla", "b", ":", " ", "a", " ", "simple", " ", "script", "ing", " ", "interface", " ", "to", " ", "Maya", "vi", "2", " ", "for", " ", "3", "D", " ", "plott", "ing", ".", "\\", "10", ";", "\\", "10", ";", "Can", " ", "be", " ", "used", " ", "insi", "de", " ", "Maya", "vi", "2", " ", "its", "elf", ",", " ", "in", " ", "\"", "ipython", " ", "--", "gui", "=", "qt", "\",", " ", "or", " ", "in", " ", "any", "\\", "10", ";", "applica", "tion", " ", "with", " ", "a", " ", "compatible", " ", "UI", " ", "(", "Qt", " ", "or", " ", "wx", "Pyth", "on", ").", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Author", ":", " ", "Pra", "bh", "u", " ", "Ram", "ach", "andra", "n", " ", "<", "pra", "bh", "u\\u", "r", "@", "users", ".", "sf", ".", "net", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "Ga", "el", " ", "Var", "oq", "ua", "ux", " ", "<", "gae", "l", " ", "dot", " ", "var", "oq", "ua", "ux", " ", "at", " ", "normal", "es", "up", " ", "dot", " ", "org", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2007", "-", "2016", ",", " ", "Ent", "hou", "ght", ",", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", ":", " ", "BS", "D", " ", "Style", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tr", "y", " ", "forcing", " ", "the", " ", "use", " ", "of", " ", "wx", " ", "2.8", " ", "bef", "ore", " ", "any", " ", "other", " ", "import", "._", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "'", "wx", "'_", "in_", "sys_", "._", "modules_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "traits_", "._", "ets", "config_", "._", "api_", "import_", "ET", "SC", "onfig_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ET", "SC", "onfig_", "._", "toolkit_", "in_", "(_", "'", "wx", "'_", ",_", "''_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "wx", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wx", "version_", "._", "ensure", "Mini", "mal", "_", "(_", "'", "2.8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "wx", "version", " ", "not", " ", "install", "ed", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Maya", "vi", " ", "imports_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "maya", "vi_", "._", "tools_", "._", "camera_", "import_", "view_", ",_", "roll_", ",_", "yaw_", ",_", "pitch_", ",_", "move_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "maya", "vi_", "._", "tools_", "._", "figure_", "import_", "figure_", ",_", "clf_", ",_", "gcf", "_", ",_", "savefig_", ",_", "draw_", ",_", "sync", "\\u", "camera_", ",_", "close_", ",_", "screenshot_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "maya", "vi_", "._", "tools_", "._", "eng", "ine", "\\u", "manager_", "import_", "get", "\\u", "engine_", ",_", "show", "\\u", "pipeline_", ",_", "options_", ",_", "set\\u", "engine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "maya", "vi_", "._", "tools_", "._", "show_", "import_", "show_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "maya", "vi_", "._", "tools_", "._", "anim", "ator_", "import_", "animate", "_", "\\u\\u\\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_", "from_", "._", "tools_", "._", "help", "er", "\\u", "functions_", "import_", "conto", "ur", "3d_", ",_", "test\\u", "conto", "ur", "3d_", ",_", "quiv", "er", "3d_", ",_", "test\\u", "quiv", "er", "3d_", ",_", "test\\u", "quiv", "er", "3d", "\\u", "2d", "\\u", "data_", ",_", "points", "3d_", ",_", "test\\u", "points", "3d_", ",_", "test\\u", "molecule_", ",_", "flow_", ",_", "test\\u", "flow_", ",_", "imshow_", ",_", "test\\u", "imshow_", ",_", "surf_", ",_", "test\\u", "surf_", ",_", "mesh_", ",_", "test\\u", "mesh_", ",_", "test\\u", "simple", "\\u", "surf_", ",_", "test\\u", "mesh", "\\u", "sphere_", ",_", "test\\u", "fancy", "\\u", "mesh_", ",_", "conto", "ur\\u", "surf_", ",_", "test\\u", "conto", "ur\\u", "surf_", ",_", "plot", "3d_", ",_", "test\\u", "plot", "3d_", ",_", "test\\u", "plot", "3d", "\\u", "anim_", ",_", "test\\u", "points", "3d", "\\u", "anim_", ",_", "test\\u", "conto", "ur", "3d", "\\u", "anim_", ",_", "test\\u", "simple", "\\u", "surf", "\\u", "anim_", ",_", "test\\u", "flow", "\\u", "anim_", ",_", "test\\u", "mesh", "\\u", "sphere", "\\u", "anim_", ",_", "triangular", "\\u", "mesh_", ",_", "test\\u", "triangular", "\\u", "mesh_", ",_", "bar", "chart_", ",_", "test\\u", "bar", "chart_", ",_", "test\\u", "mesh", "\\u", "mask", "\\u", "custom", "\\u", "colors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "tools_", "._", "decorat", "ions_", "import_", "colorbar_", ",_", "scala", "rba", "r_", ",_", "vector", "bar_", ",_", "outline_", ",_", "axes_", ",_", "xlabel_", ",_", "ylabel_", ",_", "zl", "abel_", ",_", "text_", ",_", "title_", ",_", "orientation", "\\u", "axes_", ",_", "text", "3d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "tools_", "import_", "pipeline_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "tools_", "._", "tools_", "import_", "start", "\\u", "recording_", ",_", "stop", "\\u", "recording_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "numpy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "n", "\\u", "mer_", ",_", "n", "\\u", "long_", "=_", "6_", ",_", "11_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pi_", "=_", "numpy_", "._", "pi_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dp", "hi_", "=_", "pi_", "/_", "1000.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "phi_", "=_", "numpy_", "._", "arange_", "(_", "0.0_", ",_", "2_", "*_", "pi_", "+_", "0.5_", "*_", "dp", "hi_", ",_", "dp", "hi_", ",_", "'", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mu_", "=_", "phi_", "*_", "n", "\\u", "mer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "numpy_", "._", "cos_", "(_", "mu_", ")_", "*_", "(_", "1_", "+_", "numpy_", "._", "cos_", "(_", "n", "\\u", "long_", "*_", "mu_", "/_", "n", "\\u", "mer_", ")_", "*_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "numpy_", "._", "sin_", "(_", "mu_", ")_", "*_", "(_", "1_", "+_", "numpy_", "._", "cos_", "(_", "n", "\\u", "long_", "*_", "mu_", "/_", "n", "\\u", "mer_", ")_", "*_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "z_", "=_", "numpy_", "._", "sin_", "(_", "n", "\\u", "long_", "*_", "mu_", "/_", "n", "\\u", "mer_", ")_", "*_", "0.5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pl_", "=_", "plot", "3d_", "(_", "x_", ",_", "y_", ",_", "z_", ",_", "numpy_", "._", "sin_", "(_", "mu_", ")_", ",_", "tube", "\\u", "radius_", "=_", "0.05_", ",_", "colormap_", "=_", "'", "Spectra", "l", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "colorbar_", "(_", "orientation_", "=_", "'", "vertical", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "numpy_", "._", "linspace_", "(_", "0_", ",_", "4_", "*_", "numpy_", "._", "pi_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cos_", "=_", "numpy_", "._", "cos_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sin_", "=_", "numpy_", "._", "sin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "sin_", "(_", "2_", "*_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "cos_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "z_", "=_", "sin_", "(_", "2_", "*_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "sin_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pts_", "=_", "points", "3d_", "(_", "x_", ",_", "y_", ",_", "z_", ",_", "s_", ",_", "colormap_", "=_", "\"", "Yl", "Gn", "Bu", "\"_", ",_", "scale", "\\u", "factor_", "=_", "0.1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extent_", "=_", "(_", "-_", "0.3_", ",_", "0.3_", ",_", "-_", "0.3_", ",_", "0.3_", ",_", "-_", "0.2_", ",_", "0.2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "axes_", "(_", "xlabel_", "=_", "'", "X", "'_", ",_", "ylabel_", "=_", "'", "Y", "'_", ",_", "zl", "abel_", "=_", "'", "Z", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outline_", "(_", "pl_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "title_", "(_", "'", "Maya", "vi", " ", "rock", "s", "'_", ",_", "height_", "=_", "0.85_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "show", "\\u", "engine_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Thi", "s", " ", "function", " ", "is", " ", "depre", "cated", ",", " ", "plea", "se", " ", "use", " ", "show", "\\u", "pipeline", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "warnings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "warnings_", "._", "warn_", "(_", "'", "The", " ", "show", "\\u", "eng", "ine", " ", "function", " ", "is", " ", "depre", "cated", ",", " ", "plea", "se", " ", "use", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "show", "\\u", "pipeline", "'_", ",_", "stacklevel_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "show", "\\u", "pipeline_", "(_", ")_", "\\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,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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Module is imported with 'import' and 'import from'
lorien/grab/grab/spider/base.py
[ { "content": "from __future__ import absolute_import\nimport types\nimport logging\nimport time\ntry:\n from urlparse import urljoin\nexcept ImportError:\n from urllib.parse import urljoin\nfrom random import randint\nfrom six.moves import queue\nfrom copy import deepcopy\nimport six\nimport os\nfrom weblib import metric\nfrom contextlib import contextmanager\nfrom traceback import format_exc\nimport multiprocessing\nimport threading\nfrom datetime import datetime\nimport threading\nfrom threading import Thread\nfrom collections import deque\n\nfrom grab.base import Grab\nfrom grab.error import GrabInvalidUrl\nfrom grab.spider.error import (SpiderError, SpiderMisuseError, FatalError,\n NoTaskHandler, NoDataHandler,\n SpiderConfigurationError)\nfrom grab.spider.task import Task\nfrom grab.spider.data import Data\nfrom grab.spider.transport.multicurl import MulticurlTransport\nfrom grab.proxylist import ProxyList, BaseProxySource\nfrom grab.util.misc import camel_case_to_underscore\nfrom weblib.encoding import make_str, make_unicode\nfrom grab.base import GLOBAL_STATE\nfrom grab.stat import Stat, Timer\nfrom grab.spider.parser_pipeline import ParserPipeline\nfrom grab.spider.cache_pipeline import CachePipeline\nfrom grab.spider.deprecated import DeprecatedThingsSpiderMixin\nfrom grab.util.warning import warn\n\nDEFAULT_TASK_PRIORITY = 100\nDEFAULT_NETWORK_STREAM_NUMBER = 3\nDEFAULT_TASK_TRY_LIMIT = 5\nDEFAULT_NETWORK_TRY_LIMIT = 5\nRANDOM_TASK_PRIORITY_RANGE = (50, 100)\nNULL = object()\n\nlogger = logging.getLogger('grab.spider.base')\nlogger_verbose = logging.getLogger('grab.spider.base.verbose')\n# If you need verbose logging just\n# change logging level of that logger\nlogger_verbose.setLevel(logging.FATAL)\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import multiprocessing", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 22 }, { "span": "import threading", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 16 }, { "span": "import threading", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 16 } ]
[]
1
true
[ "[CLS]_", "Module_", "is_", "imported_", "with_", "'", "import", "'_", "and_", "'", "import", " ", "from", "'_", "[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_", "import_", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "urlparse_", "import_", "urljoin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "urllib_", "._", "parse_", "import_", "urljoin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "random_", "import_", "randint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "six_", "._", "moves_", "import_", "queue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "copy_", "import_", "deepcopy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "six_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "web", "lib_", "import_", "metric_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "contextlib_", "import_", "contextmanager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "traceback_", "import_", "format\\u", "exc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "multiprocessing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "threading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "threading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "threading_", "import_", "Thread_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "collections_", "import_", "deque_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "grab_", "._", "base_", "import_", "Grab", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grab_", "._", "error_", "import_", "Grab", "Inva", "lid", "Url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grab_", "._", "spider_", "._", "error_", "import_", "(_", "Spi", "der", "Error_", ",_", "Spi", "der", "Mis", "use", "Error_", ",_", "Fat", "al", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "No", "Task", "Handler_", ",_", "No", "Data", "Handler_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Spi", "der", "Configura", "tion", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grab_", "._", "spider_", "._", "task_", "import_", "Task_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grab_", "._", "spider_", "._", "data_", "import_", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grab_", "._", "spider_", "._", "transport_", "._", "multic", "url_", "import_", "Multi", "curl", "Transport_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grab_", "._", "proxy", "list_", "import_", "Pro", "xy", "List_", ",_", "Base", "Pro", "xy", "Source_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grab_", "._", "util_", "._", "misc_", "import_", "camel", "\\u", "case", "\\u", "to", "\\u", "underscore", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "web", "lib_", "._", "encoding_", "import_", "make", "\\u", "str_", ",_", "make", "\\u", "unicode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grab_", "._", "base_", "import_", "GLOB", "AL", "\\u", "STATE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grab_", "._", "stat_", "import_", "Stat_", ",_", "Timer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grab_", "._", "spider_", "._", "parser", "\\u", "pipeline_", "import_", "Parser", "Pipeline_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grab_", "._", "spider_", "._", "cache", "\\u", "pipeline_", "import_", "Cache", "Pipeline_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grab_", "._", "spider_", "._", "deprecated_", "import_", "Dep", "reca", "ted", "Thin", "gs", "Spi", "der", "Mixin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grab_", "._", "util_", "._", "warning_", "import_", "warn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "TASK", "\\u", "PRIORITY", "_", "=_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "NET", "WORK", "\\u", "STRE", "AM", "\\u", "NUMBER_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "TASK", "\\u", "TR", "Y", "\\u", "LIMIT_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "NET", "WORK", "\\u", "TR", "Y", "\\u", "LIMIT_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "RANDOM", "\\u", "TASK", "\\u", "PRIORITY", "\\u", "RANGE_", "=_", "(_", "50_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "NULL_", "=_", "object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "'", "gra", "b", ".", "spider", ".", "base", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logg", "er", "\\u", "verbose_", "=_", "logging_", "._", "get", "Logger_", "(_", "'", "gra", "b", ".", "spider", ".", "base", ".", "verbo", "se", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "you", " ", "need", " ", "verbo", "se", " ", "logg", "ing", " ", "just", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "change", " ", "logg", "ing", " ", "level", " ", "of", " ", "tha", "t", " ", "logger_", "\\u\\u\\uNL\\u\\u\\u_", "logg", "er", "\\u", "verbose_", "._", "set", "Level_", "(_", "logging_", "._", "FATAL", "_", ")_", "\\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_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 0, 1, 2, 2, 2, 2, 2, 2, 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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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Non-standard exception raised in special method
scikit-learn/scikit-learn/sklearn/externals/funcsigs.py
[ { "content": " def __hash__(self):\n msg = \"unhashable type: '{0}'\".format(self.__class__.__name__)\n raise TypeError(msg)", "metadata": "root.Parameter.__hash__", "header": "['class', 'Parameter', '(', 'object', ')', ':', '___EOS___']", "index": 331 }, { "content": " def __hash__(self):\n msg = \"unhashable type: '{0}'\".format(self.__class__.__name__)\n raise TypeError(msg)", "metadata": "root.BoundArguments.__hash__", "header": "['class', 'BoundArguments', '(', 'object', ')', ':', '___EOS___']", "index": 430 }, { "content": " def __hash__(self):\n msg = \"unhashable type: '{0}'\".format(self.__class__.__name__)\n raise TypeError(msg)", "metadata": "root.Signature.__hash__", "header": "['class', 'Signature', '(', 'object', ')', ':', '___EOS___']", "index": 610 } ]
[ { "span": "def __hash__(self):", "start_line": 331, "start_column": 4, "end_line": 331, "end_column": 23 }, { "span": "def __hash__(self):", "start_line": 430, "start_column": 4, "end_line": 430, "end_column": 23 }, { "span": "def __hash__(self):", "start_line": 610, "start_column": 4, "end_line": 610, "end_column": 23 } ]
[]
1
true
[ "[CLS]_", "Non", "_", "-_", "standard_", "exception_", "raised_", "in_", "special_", "method_", "[SEP]_", "class_", "Parameter_", "(_", "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 ", " _", "msg_", "=_", "\"", "unh", "ash", "able", " ", "type", ":", " ", "'{", "0", "}'\"_", "._", "format_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Type", "Error_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bound", "Arguments_", "(_", "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 ", " _", "msg_", "=_", "\"", "unh", "ash", "able", " ", "type", ":", " ", "'{", "0", "}'\"_", "._", "format_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Type", "Error_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Signature_", "(_", "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 ", " _", "msg_", "=_", "\"", "unh", "ash", "able", " ", "type", ":", " ", "'{", "0", "}'\"_", "._", "format_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Type", "Error_", "(_", "msg_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
uwdata/termite-data-server/web2py/gluon/tests/test_languages.py
[ { "content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\n Unit tests for gluon.languages\n\"\"\"\n\nimport sys\nimport os\nimport unittest\nimport tempfile\nimport threading\nimport logging\n\n\nfix_sys_path()\n\n\nimport languages\nfrom storage import Storage\n\ntry:\n import multiprocessing\n\n\n\n\nexcept ImportError:\n logging.warning(\"Skipped test case, no multiprocessing module.\")\n\nif __name__ == '__main__':\n unittest.main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def fix_sys_path():\n \"\"\"\n logic to have always the correct sys.path\n '', web2py/gluon, web2py/site-packages, web2py/ ...\n \"\"\"\n\n def add_path_first(path):\n sys.path = [path] + [p for p in sys.path if (\n not p == path and not p == (path + '/'))]\n\n path = os.path.dirname(os.path.abspath(__file__))\n\n if not os.path.isfile(os.path.join(path,'web2py.py')):\n i = 0\n while i<10:\n i += 1\n if os.path.exists(os.path.join(path,'web2py.py')):\n break\n path = os.path.abspath(os.path.join(path, '..'))\n\n paths = [path,\n os.path.abspath(os.path.join(path, 'site-packages')),\n os.path.abspath(os.path.join(path, 'gluon')),\n '']\n [add_path_first(path) for path in paths]", "metadata": "root.fix_sys_path", "header": "['module', '___EOS___']", "index": 15 }, { "content": " def read_write(args):\n (filename, iterations) = args\n for i in range(0, iterations):\n content = languages.read_dict(filename)\n if not len(content):\n return False\n languages.write_dict(filename, content)\n return True", "metadata": "root.read_write", "header": "['module', '___EOS___']", "index": 49 }, { "content": " class TestLanguagesParallel(unittest.TestCase):\n\n\n", "metadata": "root.TestLanguagesParallel", "header": "['module', '___EOS___']", "index": 58 }, { "content": " def setUp(self):\n self.filename = tempfile.mktemp()\n contents = dict()\n for i in range(1000):\n contents[\"key%d\" % i] = \"value%d\" % i\n languages.write_dict(self.filename, contents)\n languages.read_dict(self.filename)", "metadata": "root.TestLanguagesParallel.setUp", "header": "['class', 'TestLanguagesParallel', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 60 }, { "content": " def tearDown(self):\n try:\n os.remove(self.filename)\n except:\n pass", "metadata": "root.TestLanguagesParallel.tearDown", "header": "['class', 'TestLanguagesParallel', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 68 }, { "content": " def test_reads_and_writes(self):\n readwriters = 10\n pool = multiprocessing.Pool(processes=readwriters)\n results = pool.map(read_write, [[self.filename, 10]] * readwriters)\n for result in results:\n self.assertTrue(result)", "metadata": "root.TestLanguagesParallel.test_reads_and_writes", "header": "['class', 'TestLanguagesParallel', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 74 }, { "content": " class TestTranslations(unittest.TestCase):\n\n\n", "metadata": "root.TestTranslations", "header": "['module', '___EOS___']", "index": 81 }, { "content": " def setUp(self):\n if os.path.isdir('gluon'):\n self.langpath = 'applications/welcome/languages'\n else:\n self.langpath = os.path.realpath(\n '../../applications/welcome/languages')\n self.http_accept_language = 'en'", "metadata": "root.TestTranslations.setUp", "header": "['class', 'TestTranslations', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 83 }, { "content": " def tearDown(self):\n pass", "metadata": "root.TestTranslations.tearDown", "header": "['class', 'TestTranslations', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 91 }, { "content": " def test_plain(self):\n T = languages.translator(self.langpath, self.http_accept_language)\n self.assertEqual(str(T('Hello World')),\n 'Hello World')\n self.assertEqual(str(T('Hello World## comment')),\n 'Hello World')\n self.assertEqual(str(T('%s %%{shop}', 1)),\n '1 shop')\n self.assertEqual(str(T('%s %%{shop}', 2)),\n '2 shops')\n self.assertEqual(str(T('%s %%{shop[0]}', 1)),\n '1 shop')\n self.assertEqual(str(T('%s %%{shop[0]}', 2)),\n '2 shops')\n self.assertEqual(str(T('%s %%{quark[0]}', 1)),\n '1 quark')\n self.assertEqual(str(T('%s %%{quark[0]}', 2)),\n '2 quarks')\n self.assertEqual(str(T.M('**Hello World**')),\n '<strong>Hello World</strong>')\n T.force('it')\n self.assertEqual(str(T('Hello World')),\n 'Salve Mondo')", "metadata": "root.TestTranslations.test_plain", "header": "['class', 'TestTranslations', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 94 } ]
[ { "span": "import threading", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 16 }, { "span": "from storage import Storage", "start_line": 44, "start_column": 0, "end_line": 44, "end_column": 27 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Unit", " ", "tests", " ", "for", " ", "glu", "on", ".", "language", "s", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\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_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "threading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\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\\uDEDENT\\u\\u\\u_", "fix", "\\u", "sys", "\\u", "path_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "languages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "storage_", "import_", "Storage_", "\\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_", "multiprocessing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "warning_", "(_", "\"", "Skipped", " ", "test", " ", "case", ",", " ", "no", " ", "multipro", "cess", "ing", " ", "module", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unittest_", "._", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "fix", "\\u", "sys", "\\u", "path_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "logic", " ", "to", " ", "have", " ", "alw", "ay", "s", " ", "the", " ", "correct", " ", "sys", ".", "path", "\\", "10", ";", " ", "''", ",", " ", "web", "2py", "/", "glu", "on", ",", " ", "web", "2py", "/", "site", "-", "package", "s", ",", " ", "web", "2py", "/", " ", "...", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "add", "\\u", "path", "\\u", "first_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "path_", "=_", "[_", "path_", "]_", "+_", "[_", "p_", "for_", "p_", "in_", "sys_", "._", "path_", "if_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "not_", "p_", "==_", "path_", "and_", "not_", "p_", "==_", "(_", "path_", "+_", "'/'_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "path_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isfile_", "(_", "os_", "._", "path_", "._", "join_", "(_", "path_", ",_", "'", "web", "2py", ".", "py", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "i_", "<_", "10_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "os_", "._", "path_", "._", "join_", "(_", "path_", ",_", "'", "web", "2py", ".", "py", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "path_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "os_", "._", "path_", "._", "join_", "(_", "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_", "paths_", "=_", "[_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "abspath_", "(_", "os_", "._", "path_", "._", "join_", "(_", "path_", ",_", "'", "site", "-", "package", "s", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "abspath_", "(_", "os_", "._", "path_", "._", "join_", "(_", "path_", ",_", "'", "glu", "on", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "''_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[_", "add", "\\u", "path", "\\u", "first_", "(_", "path_", ")_", "for_", "path_", "in_", "paths_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "read", "\\u", "write_", "(_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "filename_", ",_", "iterations_", ")_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "0_", ",_", "iterations_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "content_", "=_", "languages_", "._", "read", "\\u", "dict_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "len_", "(_", "content_", ")_", ":_", "\\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_", "languages_", "._", "write", "\\u", "dict_", "(_", "filename_", ",_", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Languages", "Parallel", "_", "(_", "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", "Languages", "Parallel", "_", "(_", "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_", "._", "filename_", "=_", "tempfile_", "._", "mktemp_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contents_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "1000_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "contents_", "[_", "\"", "key", "%", "d", "\"_", "%_", "i_", "]_", "=_", "\"", "value", "%", "d", "\"_", "%_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "languages_", "._", "write", "\\u", "dict_", "(_", "self_", "._", "filename_", ",_", "contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "languages_", "._", "read", "\\u", "dict_", "(_", "self_", "._", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Languages", "Parallel", "_", "(_", "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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "remove_", "(_", "self_", "._", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Languages", "Parallel", "_", "(_", "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", "reads", "\\u", "and", "\\u", "writes", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "read", "writers_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pool_", "=_", "multiprocessing_", "._", "Pool_", "(_", "processes_", "=_", "read", "writers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "pool_", "._", "map_", "(_", "read", "\\u", "write_", ",_", "[_", "[_", "self_", "._", "filename_", ",_", "10_", "]_", "]_", "*_", "read", "writers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "result_", "in_", "results_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Translat", "ions_", "(_", "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", "Translat", "ions_", "(_", "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 ", " _", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "'", "glu", "on", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "lang", "path_", "=_", "'", "applica", "tion", "s", "/", "welcome", "/", "language", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "lang", "path_", "=_", "os_", "._", "path_", "._", "realpath_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'../../", "applica", "tion", "s", "/", "welcome", "/", "language", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "http", "\\u", "accept", "\\u", "language_", "=_", "'", "en", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Translat", "ions_", "(_", "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_", "Test", "Translat", "ions_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "plain_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "T_", "=_", "languages_", "._", "translator_", "(_", "self_", "._", "lang", "path_", ",_", "self_", "._", "http", "\\u", "accept", "\\u", "language_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "str_", "(_", "T_", "(_", "'", "Hell", "o", " ", "Wor", "ld", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Hell", "o", " ", "Wor", "ld", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "str_", "(_", "T_", "(_", "'", "Hell", "o", " ", "Wor", "ld", "##", " ", "comment", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Hell", "o", " ", "Wor", "ld", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "str_", "(_", "T_", "(_", "'%", "s", " ", "%%", "{", "shop", "}'_", ",_", "1_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "1", " ", "shop", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "str_", "(_", "T_", "(_", "'%", "s", " ", "%%", "{", "shop", "}'_", ",_", "2_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "2", " ", "shop", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "str_", "(_", "T_", "(_", "'%", "s", " ", "%%", "{", "shop", "[", "0", "]}", "'_", ",_", "1_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "1", " ", "shop", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "str_", "(_", "T_", "(_", "'%", "s", " ", "%%", "{", "shop", "[", "0", "]}", "'_", ",_", "2_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "2", " ", "shop", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "str_", "(_", "T_", "(_", "'%", "s", " ", "%%", "{", "quark", "[", "0", "]}", "'_", ",_", "1_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "1", " ", "quark", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "str_", "(_", "T_", "(_", "'%", "s", " ", "%%", "{", "quark", "[", "0", "]}", "'_", ",_", "2_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "2", " ", "quark", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "str_", "(_", "T_", "._", "M_", "(_", "'**", "Hell", "o", " ", "Wor", "ld", "**'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'<", "strong", ">", "Hell", "o", " ", "Wor", "ld", "</", "strong", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "T_", "._", "force_", "(_", "'", "it", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "str_", "(_", "T_", "(_", "'", "Hell", "o", " ", "Wor", "ld", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Sal", "ve", " ", "Mon", "do", "'_", ")_", "\\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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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 ]
Unused import
Microsoft/ivy/src/ivy/ivy_transrel.py
[ { "content": "#\n# Copyright (c) Microsoft Corporation. All Rights Reserved.\n#\n\"\"\" Functions for manipluating transition relations as two-vocabulary formulas\n\nUpdates represent the semantics of actions and states. Both kinds of\nupdates have a set of modified symbols. The difference is that action\nstyle uses \"new\" versions of the symbols to represent the post-state,\nwhile state style uses \"old\" version to represent the pre-state. In a\n\"pure\" state, the modifies set is \"all\" and the \"old\" symbols are not\nreferred to. That is, a pure state says nothing about the initial\ncondition. On the other hand, the state of a procedure is\n\"impure\". The initial state of a procedure has an empty modifies set,\nmeaning mean the current values are all equal to the initial values.\n\nAn update is represented as a triple (mod,tr,pre) where mod is a list\nof modified symbols (or \"all\") and tr is a two-vocabulary transition\nrelation, and pre is a one-vocabulary precondition. The precondition\nis stated in the negative, so that an action *fails* in a state s if\nst /\\ axioms /\\ pre is satisfiable. The tr and pre are both implicitly\nexistentially quantified over the skolem symbols.\n\nBecause pre is negative, we say that an action a = (mod_a,tr_a,pre_a)\n*refines* (is a safe replacement for) an action b = (mod_b,tr_b,pre_b)\nwhen pre_a => pre_b and frame(mod_a) /\\ tr_a => frame(mod_b) /\\\ntr_b. Here, frame(S), where S is a set of symbols, is the condition\nthat all symbols *not* in S are preserved.\n\n\"\"\"\n\nfrom ivy_utils import UniqueRenamer, union_to_list, list_union, list_diff, IvyError, inverse_map, compose_maps, pretty\nfrom ivy_logic import Variable, Constant, Literal, Atom, Not, And, Or,App, RelationSort, Definition, is_prenex_universal\nfrom ivy_logic_utils import used_symbols_clauses, rename_clauses, clauses_using_symbols, simplify_clauses,\\\n used_variables_clauses, used_constants_clauses, substitute_constants_clause, substitute_constants_clauses, constants_clauses,\\\n relations_clauses, eq_lit, condition_clauses, or_clauses, and_clauses, false_clauses, true_clauses,\\\n formula_to_clauses, clauses_to_formula, formula_to_clauses_tseitin, is_ground_clause, \\\n relations_clause, Clauses, sym_inst, negate_clauses, negate\nfrom ivy_solver import unsat_core, clauses_imply, clauses_imply_formula, clauses_sat, clauses_case, get_model_clauses, clauses_model_to_clauses, get_small_model\nimport ivy_logic\nimport ivy_logic_utils as lu\nimport ivy_utils as iu\nfrom logic_util import is_tautology_equality\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# TODO: this will be quadratic for chains of updates\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", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def new(sym):\n \"\"\" Return the \"new\" version of symbol \"sym\", that is, the one\n representing \"sym\" in the post_state.\n \"\"\"\n return sym.prefix('new_')", "metadata": "root.new", "header": "['module', '___EOS___']", "index": 44 }, { "content": "def is_new(sym):\n return sym.startswith('new_')", "metadata": "root.is_new", "header": "['module', '___EOS___']", "index": 50 }, { "content": "def new_of(sym):\n return sym.drop_prefix('new_')", "metadata": "root.new_of", "header": "['module', '___EOS___']", "index": 53 }, { "content": "def old(sym):\n \"\"\" Return the \"old\" version of symbol \"sym\", that is, the one\n representing \"sym\" in the pre_state.\n \"\"\"\n return sym.prefix('old_')", "metadata": "root.old", "header": "['module', '___EOS___']", "index": 56 }, { "content": "def is_old(sym):\n return sym.startswith('old_')", "metadata": "root.is_old", "header": "['module', '___EOS___']", "index": 62 }, { "content": "def old_of(sym):\n return sym.drop_prefix('old_')", "metadata": "root.old_of", "header": "['module', '___EOS___']", "index": 65 }, { "content": "def rename(sym,rn):\n return sym.rename(rn)", "metadata": "root.rename", "header": "['module', '___EOS___']", "index": 68 }, { "content": "def is_skolem(sym):\n \"\"\"\n Symbols with __ in them in the TR are considerd to be implicitly existentially quantified.\n \"\"\"\n return sym.contains('__')", "metadata": "root.is_skolem", "header": "['module', '___EOS___']", "index": 71 }, { "content": "def null_update():\n return ([],true_clauses(),false_clauses())", "metadata": "root.null_update", "header": "['module', '___EOS___']", "index": 77 }, { "content": "def pure_state(clauses):\n return (None,clauses,false_clauses())", "metadata": "root.pure_state", "header": "['module', '___EOS___']", "index": 80 }, { "content": "def is_pure_state(state):\n return state[0] == None", "metadata": "root.is_pure_state", "header": "['module', '___EOS___']", "index": 83 }, { "content": "def top_state():\n return pure_state(true_clauses())", "metadata": "root.top_state", "header": "['module', '___EOS___']", "index": 86 }, { "content": "def bottom_state():\n return pure_state(false_clauses())", "metadata": "root.bottom_state", "header": "['module', '___EOS___']", "index": 89 }, { "content": "def state_postcond(state):\n return state[1]", "metadata": "root.state_postcond", "header": "['module', '___EOS___']", "index": 92 }, { "content": "def state_precond(state):\n return state[2]", "metadata": "root.state_precond", "header": "['module', '___EOS___']", "index": 95 }, { "content": "def state_to_action(update):\n \"\"\" convert from the \"state\" style to the \"action\" style \"\"\"\n updated,postcond,pre = update\n postcond,pre = clausify(postcond), clausify(pre)\n renaming = dict()\n for s in updated:\n renaming[s] = new(s)\n for s in used_symbols_clauses(postcond):\n if is_old(s):\n renaming[s] = old_of(s)\n return (updated,rename_clauses(postcond,renaming),pre)", "metadata": "root.state_to_action", "header": "['module', '___EOS___']", "index": 98 }, { "content": "def action_to_state(update):\n \"\"\" convert from the \"action\" style to the \"state\" style \"\"\"\n updated,tr,pre = update\n renaming = dict()\n for s in updated:\n renaming[s] = old(s)\n for s in used_symbols_clauses(tr):\n if is_new(s):\n renaming[s] = new_of(s)\n return (updated,rename_clauses(tr,renaming),pre)", "metadata": "root.action_to_state", "header": "['module', '___EOS___']", "index": 110 }, { "content": "def update_frame_constraint(update,relations):\n \"\"\" Return a clause list constraining all updated symbols\n to keep their previous values \"\"\"\n clauses = []\n for sym in update[0]:\n if sym in relations:\n arity = relations[sym]\n vs = [Variable(\"V{}\".format(i)) for i in range(0,arity)]\n lit1 = Literal(1,Atom(sym,vs))\n lit2 = Literal(1,Atom(new(sym),vs))\n clauses += [[~lit1,lit2],[lit1,~lit2]]\n else:\n clauses.append([eq_lit(Constant(sym),Constant(new(sym)))])\n return Clauses(clauses)", "metadata": "root.update_frame_constraint", "header": "['module', '___EOS___']", "index": 121 }, { "content": "def frame_def(sym,op):\n \"\"\" Add the condition that sym remains unchanged to a\n transition relation (using op = {new,old})\"\"\"\n lhs = sym_inst(op(sym) if op is new else sym)\n rhs = sym_inst(sym if op is new else op(sym))\n dfn = Definition(lhs,rhs)\n return dfn", "metadata": "root.frame_def", "header": "['module', '___EOS___']", "index": 137 }, { "content": "def frame(updated,relations,op):\n \"\"\" Return a clause list constraining all updated symbols\n to keep their op values, for op = new,old \"\"\"\n return Clauses([],[frame_def(sym,op) for sym in updated])", "metadata": "root.frame", "header": "['module', '___EOS___']", "index": 145 }, { "content": "def symbol_frame_cond(sym,sig):\n \"\"\" Return transition relation implying that sym remains unchanged \"\"\"\n return Clauses([],[frame_def(sym,new)])", "metadata": "root.symbol_frame_cond", "header": "['module', '___EOS___']", "index": 150 }, { "content": "def frame_update(update,in_scope,sig):\n \"\"\" Modify an update so all symbols in \"in_scope\" are on the\n update list, preserving semantics.\n \"\"\"\n updated,clauses,pre = update\n moded = set(updated)\n dfns = []\n for sym in in_scope:\n if sym not in moded:\n updated.append(sym)\n dfns.append(frame_def(sym,new))\n return (updated,and_clauses(clauses,Clauses([],dfns)),pre)", "metadata": "root.frame_update", "header": "['module', '___EOS___']", "index": 154 }, { "content": "def diff_frame(updated1,updated2,relations,op):\n if updated1 == None or updated2 == None: return Clauses([])\n updated = list_diff(updated2,updated1)\n return frame(updated,relations,op)", "metadata": "root.diff_frame", "header": "['module', '___EOS___']", "index": 167 }, { "content": "def updated_join(updated1,updated2):\n if updated1 == None or updated1 == None: return None\n return list_union(updated1,updated2)", "metadata": "root.updated_join", "header": "['module', '___EOS___']", "index": 172 }, { "content": "def join(s1,s2,relations,op):\n u1,c1,p1 = s1\n u2,c2,p2 = s2\n df12 = diff_frame(u1,u2,relations,op)\n df21 = diff_frame(u2,u1,relations,op)\n c1 = and_clauses(c1,df12)\n c2 = and_clauses(c2,df21)\n p1 = and_clauses(p1,df12)\n p2 = and_clauses(p2,df21)\n u = updated_join(u1,u2)\n c = or_clauses(c1,c2)\n p = or_clauses(p1,p2)\n return (u,c,p)", "metadata": "root.join", "header": "['module', '___EOS___']", "index": 176 }, { "content": "class CounterExample(object):", "metadata": "root.CounterExample", "header": "['module', '___EOS___']", "index": 190 }, { "content": " def __init__(self,clauses):\n self.clauses = clauses", "metadata": "root.CounterExample.__init__", "header": "['class', 'CounterExample', '(', 'object', ')', ':', '___EOS___']", "index": 191 }, { "content": " def __nonzero__(self):\n return False", "metadata": "root.CounterExample.__nonzero__", "header": "['class', 'CounterExample', '(', 'object', ')', ':', '___EOS___']", "index": 193 }, { "content": "def clauses_imply_formula_cex(clauses,fmla):\n if clauses_imply_formula(clauses,fmla):\n return True\n return CounterExample(conjoin(clauses,negate_clauses(formula_to_clauses(fmla))))", "metadata": "root.clauses_imply_formula_cex", "header": "['module', '___EOS___']", "index": 196 }, { "content": "def implies(s1,s2,axioms,relations,op):\n u1,c1,p1 = s1\n u2,c2,p2 = s2\n if u1 == None and u2 != None:\n return False\n# print \"c1: {}\".format(c1)\n# print \"axioms: {}\".format(axioms)\n# print \"df: {}\".format(diff_frame(u1,u2,relations,op))\n c1 = and_clauses(c1,axioms,diff_frame(u1,u2,relations,op))\n if isinstance(c2,Clauses):\n if not c2.is_universal_first_order() or not p2.is_universal_first_order():\n return False\n c2 = and_clauses(c2,diff_frame(u2,u1,relations,op))\n return clauses_imply(p1,p2) and clauses_imply(c1,c2)\n else:\n if not is_prenex_universal(c2) or not is_prenex_universal(p2):\n return False\n c2 = And(c2,clauses_to_formula(diff_frame(u2,u1,relations,op)))\n return clauses_imply_formula_cex(p1,p2) and clauses_imply_formula_cex(c1,c2)", "metadata": "root.implies", "header": "['module', '___EOS___']", "index": 201 }, { "content": "def implies_state(s1,s2,axioms,relations):\n return implies(s1,s2,axioms,relations,old)", "metadata": "root.implies_state", "header": "['module', '___EOS___']", "index": 221 }, { "content": "def implies_action(s1,s2,axioms,relations):\n return implies(s1,s2,axioms,relations,new)", "metadata": "root.implies_action", "header": "['module', '___EOS___']", "index": 224 }, { "content": "def join_state(s1,s2,relations):\n return join(clausify_state(s1),clausify_state(s2),relations,old)", "metadata": "root.join_state", "header": "['module', '___EOS___']", "index": 227 }, { "content": "def join_action(s1,s2,relations):\n return join(s1,s2,relations,new)", "metadata": "root.join_action", "header": "['module', '___EOS___']", "index": 230 }, { "content": "def condition_update_on_fmla(update,fmla,relations):\n \"\"\"Given an update, return an update conditioned on fmla. Maybe an \"else\" would\n be useful too :-).\n \"\"\"\n updated,if_clauses,if_pre = update\n else_clauses = update_frame_constraint(update,relations)\n if_clauses = condition_clauses(if_clauses,fmla)\n else_clauses = condition_clauses(else_clauses,Not(fmla))\n## print \"if_clauses: %s\" % if_clauses\n## print \"else_clauses: %s\" % else_clauses\n return updated,(and_clauses(if_clauses,else_clauses)),if_pre", "metadata": "root.condition_update_on_fmla", "header": "['module', '___EOS___']", "index": 233 }, { "content": "def rename_distinct(clauses1,clauses2):\n \"\"\" rename skolems in clauses1 so they don't occur in clauses2.\n \"\"\"\n# print \"rename_distinct clauses1 = {}\".format(clauses1)\n# print \"rename_distinct clauses2 = {!r}\".format(clauses2)\n used1 = used_symbols_clauses(clauses1)\n used2 = used_symbols_clauses(clauses2)\n rn = UniqueRenamer('',used2)\n map1 = dict()\n for s in used1:\n if is_skolem(s):\n map1[s] = rename(s,rn)\n return rename_clauses(clauses1,map1)", "metadata": "root.rename_distinct", "header": "['module', '___EOS___']", "index": 245 }, { "content": "def compose_updates(update1,axioms,update2):\n updated1, clauses1, pre1 = update1\n updated2, clauses2, pre2 = update2\n clauses2 = rename_distinct(clauses2,clauses1)\n pre2 = rename_distinct(pre2,clauses1)\n# print \"clauses2 = {}\".format(clauses2)\n us1 = set(updated1)\n us2 = set(updated2)\n mid = us1.intersection(us2)\n mid_ax = clauses_using_symbols(mid,axioms)\n used = used_symbols_clauses(and_clauses(clauses1,clauses2))\n rn = UniqueRenamer('__m_',used)\n map1 = dict()\n map2 = dict()\n for v in updated1:\n map2[v] = new(v)\n for mv in mid:\n mvf = rename(mv,rn)\n map1[new(mv)] = mvf\n map2[mv] = mvf\n clauses1 = rename_clauses(clauses1,map1)\n new_clauses = and_clauses(clauses1, rename_clauses(and_clauses(clauses2,mid_ax),map2))\n new_updated = list(us1.union(us2))\n# print \"pre1 before = {}\".format(pre1)\n pre1 = and_clauses(pre1,diff_frame(updated1,updated2,None,new)) # keep track of post-state of assertion failure\n# print \"pre1 = {}\".format(pre1)\n new_pre = or_clauses(pre1,and_clauses(clauses1,rename_clauses(and_clauses(pre2,mid_ax),map2)))\n# print \"new_pre = {}\".format(new_pre)\n return (new_updated,new_clauses,new_pre)", "metadata": "root.compose_updates", "header": "['module', '___EOS___']", "index": 261 }, { "content": "def exist_quant_map(syms,clauses):\n used = used_symbols_clauses(clauses)\n rn = UniqueRenamer('__',used)\n map1 = dict()\n for s in syms:\n map1[s] = rename(s,rn)\n return map1,rename_clauses(clauses,map1)", "metadata": "root.exist_quant_map", "header": "['module', '___EOS___']", "index": 291 }, { "content": "def exist_quant(syms,clauses):\n map1,res = exist_quant_map(syms,clauses)\n return res", "metadata": "root.exist_quant", "header": "['module', '___EOS___']", "index": 299 }, { "content": "def conjoin(clauses1,clauses2):\n \"\"\" Conjoin clause sets, taking into account skolems \"\"\"\n return and_clauses(clauses1,rename_distinct(clauses2,clauses1))", "metadata": "root.conjoin", "header": "['module', '___EOS___']", "index": 303 }, { "content": "def constrain_state(upd,fmla):\n return (upd[0],and_clauses(upd[1],formula_to_clauses(fmla)),upd[2])", "metadata": "root.constrain_state", "header": "['module', '___EOS___']", "index": 307 }, { "content": "def hide(syms,update):\n syms = set(syms)\n syms.update(new(s) for s in update[0] if s in syms)\n new_updated = [s for s in update[0] if s not in syms]\n new_tr = exist_quant(syms,update[1])\n new_pre = exist_quant(syms,update[2])\n return (new_updated,new_tr,new_pre)", "metadata": "root.hide", "header": "['module', '___EOS___']", "index": 310 }, { "content": "def hide_state(syms,update):\n syms = set(syms)\n if update[0] != None:\n syms.update(old(s) for s in update[0] if s in syms)\n new_updated = [s for s in update[0] if s not in syms]\n else:\n new_updated = None\n new_tr = exist_quant(syms,update[1])\n new_pre = exist_quant(syms,update[2])\n return (new_updated,new_tr,new_pre)", "metadata": "root.hide_state", "header": "['module', '___EOS___']", "index": 318 }, { "content": "def hide_state_map(syms,update):\n syms = set(syms)\n if update[0] != None:\n syms.update(old(s) for s in update[0] if s in syms)\n new_updated = [s for s in update[0] if s not in syms]\n else:\n new_updated = None\n trmap,new_tr = exist_quant_map(syms,update[1])\n new_pre = exist_quant(syms,update[2])\n return trmap, (new_updated,new_tr,new_pre)", "metadata": "root.hide_state_map", "header": "['module', '___EOS___']", "index": 329 }, { "content": "def subst_action(update,subst):\n print subst\n syms = dict(subst.iteritems())\n syms.update((new(s),new(syms[s])) for s in update[0] if s in syms)\n print syms\n new_updated = [subst.get(s,s) for s in update[0]]\n new_tr = rename_clauses(update[1],syms)\n new_pre = rename_clauses(update[2],syms)\n return (new_updated,new_tr,new_pre)", "metadata": "root.subst_action", "header": "['module', '___EOS___']", "index": 340 }, { "content": "def forward_image_map(pre_state,axioms,update):\n updated, clauses, _precond = update\n# print \"transition_relation: {}\".format(clauses)\n pre_ax = clauses_using_symbols(updated,axioms)\n pre = conjoin(pre_state,pre_ax)\n map1,res = exist_quant_map(updated,conjoin(pre,clauses))\n res = rename_clauses(res, dict((new(x),x) for x in updated))\n## print \"before simp: %s\" % res\n # res = simplify_clauses(res)\n return map1,res", "metadata": "root.forward_image_map", "header": "['module', '___EOS___']", "index": 350 }, { "content": "def forward_image(pre_state,axioms,update):\n map1,res = forward_image_map(pre_state,axioms,update)\n return res", "metadata": "root.forward_image", "header": "['module', '___EOS___']", "index": 361 }, { "content": "def action_failure(action):\n upd,tr,pre = action\n return upd,pre,true_clauses()", "metadata": "root.action_failure", "header": "['module', '___EOS___']", "index": 365 }, { "content": "class ActionFailed(Exception):", "metadata": "root.ActionFailed", "header": "['module', '___EOS___']", "index": 369 }, { "content": " def __init__(self,clauses,trans):\n self.clauses = clauses\n self.trans = trans", "metadata": "root.ActionFailed.__init__", "header": "['class', 'ActionFailed', '(', 'Exception', ')', ':', '___EOS___']", "index": 370 }, { "content": "def clausify(f):\n return f if isinstance(f,Clauses) else formula_to_clauses(f)", "metadata": "root.clausify", "header": "['module', '___EOS___']", "index": 374 }, { "content": "def clausify_state(s):\n upd,tr,pre = s\n return (upd,clausify(tr),clausify(pre))", "metadata": "root.clausify_state", "header": "['module', '___EOS___']", "index": 377 }, { "content": "def remove_taut_eqs_clauses(clauses):\n return Clauses(\n [f for f in clauses.fmlas if not is_tautology_equality(f)],\n clauses.defs\n )", "metadata": "root.remove_taut_eqs_clauses", "header": "['module', '___EOS___']", "index": 382 }, { "content": "def extract_pre_post_model(clauses,model,updated):\n renaming = dict((v,new(v)) for v in updated)\n ignore = lambda s: s.is_skolem() or is_new(s)\n pre_clauses = clauses_model_to_clauses(clauses,ignore = ignore,model = model,numerals=use_numerals())\n ignore = lambda s: s.is_skolem() or (not is_new(s) and s in renaming)\n post_clauses = clauses_model_to_clauses(clauses,ignore = ignore,model = model,numerals=use_numerals())\n post_clauses = rename_clauses(post_clauses,inverse_map(renaming))\n return map(remove_taut_eqs_clauses,(pre_clauses,post_clauses))", "metadata": "root.extract_pre_post_model", "header": "['module', '___EOS___']", "index": 388 }, { "content": "def compose_state_action(state,axioms,action, check=True):\n \"\"\" Compose a state and an action, returning a state \"\"\"\n# print \"state: {}\".format(state)\n# print \"action: {}\".format(action)\n su,sc,sp = state\n au,ac,ap = action\n sc,sp = clausify(sc),clausify(sp)\n if check:\n pre_test = and_clauses(and_clauses(sc,ap),axioms)\n model = small_model_clauses(pre_test)\n if model != None:\n trans = extract_pre_post_model(pre_test,model,au)\n post_updated = [new(s) for s in au]\n pre_test = exist_quant(post_updated,pre_test)\n raise ActionFailed(pre_test,trans)\n if su != None: # none means all moded\n ssu = set(su) # symbols already modified in state\n rn = dict((x,old(x)) for x in au if x not in ssu)\n sc = rename_clauses(sc,rn)\n ac = rename_clauses(ac,rn)\n su = list(su)\n union_to_list(su,au)\n img = forward_image(sc,axioms,action)\n## print \"compose: {}\".format((su,img,sp))\n return (su,img,sp)", "metadata": "root.compose_state_action", "header": "['module', '___EOS___']", "index": 397 }, { "content": "def reverse_image(post_state,axioms,update):\n updated, clauses, _precond = update\n post_ax = clauses_using_symbols(updated,axioms)\n post_clauses = conjoin(post_state,post_ax)\n post_clauses = rename_clauses(post_clauses, dict((x,new(x)) for x in updated))\n post_updated = [new(s) for s in updated]\n res = exist_quant(post_updated,conjoin(clauses,post_clauses))\n# res = simplify_clauses(res)\n return res", "metadata": "root.reverse_image", "header": "['module', '___EOS___']", "index": 424 }, { "content": "def interpolant(clauses1,clauses2,axioms,interpreted):\n# print \"interpolant clauses1={} clauses2={}\".format(clauses1,clauses2)\n# print \"axioms = {}\".format(axioms)\n foo = and_clauses(clauses1,axioms)\n clauses2 = simplify_clauses(clauses2)\n core = unsat_core(clauses2,foo)\n if core == None:\n return None\n# print \"core: %s\" % core\n return core, interp_from_unsat_core(clauses2,foo,core,interpreted)", "metadata": "root.interpolant", "header": "['module', '___EOS___']", "index": 434 }, { "content": "def forward_interpolant(pre_state,update,post_state,axioms,interpreted):\n return interpolant(forward_image(pre_state,axioms,update),post_state,axioms,interpreted)", "metadata": "root.forward_interpolant", "header": "['module', '___EOS___']", "index": 445 }, { "content": "def reverse_interpolant_case(post_state,update,pre_state,axioms,interpreted):\n pre = reverse_image(post_state,axioms,update)\n pre_case = clauses_case(pre)\n## print \"pre_case1: {}\".format(pre_case)\n pre_case = [cl for cl in pre_case if len(cl) <= 1\n and is_ground_clause(cl)\n and not any(is_skolem(r) for r,n in relations_clause(cl))]\n## print \"pre_case2: {}\".format(pre_case)\n return interpolant(pre_state,pre_case,axioms,interpreted)", "metadata": "root.reverse_interpolant_case", "header": "['module', '___EOS___']", "index": 448 }, { "content": "def interpolant_case(pre_state,post,axioms,interpreted):\n# print \"interpolant_case: before clauses_case\"\n# print \"interpolant_case post: {}\".format(post)\n post_case = clauses_case(post)\n# print \"interpolant_case: after clauses_case\"\n## print \"post_case1: {}\".format(post_case)\n post_case = Clauses([cl for cl in post_case.clauses\n if len(cl) <= 1\n and is_ground_clause(cl)\n and not any(is_skolem(r) for r,n in relations_clause(cl))])\n# print \"interpolant_case: after filtering\"\n# print \"post_case2: {}\".format(post_case)\n return interpolant(pre_state,post_case,axioms,interpreted)", "metadata": "root.interpolant_case", "header": "['module', '___EOS___']", "index": 458 }, { "content": "def interp_from_unsat_core(clauses1,clauses2,core,interpreted):\n used_syms = used_symbols_clauses(core)\n vars = used_variables_clauses(core)\n if vars:\n# print \"interpolant would require skolem constants\"\n return None\n core_consts = used_constants_clauses(core)\n clauses2_consts = used_constants_clauses(clauses2)\n# print \"interp_from_unsat_core core_consts = {}\".format(map(str,core_consts))\n# print \"interp_from_unsat_core clauses2_consts = {}\".format(map(str,clauses2_consts))\n renaming = dict()\n i = 0\n for v in core_consts:\n if v not in clauses2_consts or v.is_skolem(): # and v not in interpreted:\n renaming[v] = Variable('V' + str(i),Constant(v).get_sort())\n i += 1\n# print \"interp_from_unsat_core core = {}\".format(core)\n# print \"interp_from_unsat_core renaming = {}\".format(renaming)\n renamed_core = substitute_constants_clauses(core,renaming)\n# print \"interp_from_unsat_core renamed_core = {}\".format(renamed_core)\n res = simplify_clauses(Clauses([Or(*[negate(c) for c in renamed_core.fmlas])]))\n# print \"interp_from_unsat_core res = {}\".format(res)\n return res", "metadata": "root.interp_from_unsat_core", "header": "['module', '___EOS___']", "index": 472 }, { "content": "def small_model_clauses(cls):\n # Don't try to shrink the integers!\n return get_small_model(cls,ivy_logic.uninterpreted_sorts(),[])", "metadata": "root.small_model_clauses", "header": "['module', '___EOS___']", "index": 496 }, { "content": "class History(object):\n \"\"\" A history is a symbolically represented sequence of states. \"\"\"\n\n\n\n\n", "metadata": "root.History", "header": "['module', '___EOS___']", "index": 500 }, { "content": " def __init__(self,state,maps = []):\n \"\"\" state is the initial state of the history \"\"\"\n# print \"init: {}\".format(state)\n update,clauses,pre = state\n assert update == None and pre.is_false()\n self.maps = maps # sequence of symbol renamings resulting from forward images\n self.post = clauses # characteristic formula of the history", "metadata": "root.History.__init__", "header": "['class', 'History', '(', 'object', ')', ':', '___EOS___']", "index": 502 }, { "content": " def forward_step(self,axioms,update):\n \"\"\" This is like forward_image on states, but records the\n symbol renaming used in the forward image. The list of\n renamings is used to reconstruct the state symbols at previous\n times in the history. A new history after forward step is\n returned. \"\"\"\n# print \"step: pre = {}, axioms = {}, update = {}\".format(self.post,axioms,update)\n map1,res = forward_image_map(self.post,axioms,update)\n return History(pure_state(res),self.maps + [map1])", "metadata": "root.History.forward_step", "header": "['class', 'History', '(', 'object', ')', ':', '___EOS___']", "index": 511 }, { "content": " def assume(self,clauses):\n \"\"\" Returns a new history in which the final state is constrainted to\n satisfy \"clauses\".\"\"\"\n# print \"assume post: {}\".format(self.post)\n# print \"assume: {}\".format(clauses)\n if isinstance(clauses,tuple): # a pure state\n assert is_pure_state(clauses)\n clauses = clauses[1]\n clauses = rename_distinct(clauses,self.post) # TODO: shouldn't be needed\n return History(pure_state(and_clauses(self.post,clauses)),self.maps)", "metadata": "root.History.assume", "header": "['class', 'History', '(', 'object', ')', ':', '___EOS___']", "index": 521 }, { "content": " def ignore(self,s,img,renaming):\n res = not(s in img or not s.is_skolem() and s not in renaming)\n# print \"ignore: {} = {}\".format(s,res)\n return res", "metadata": "root.History.ignore", "header": "['class', 'History', '(', 'object', ')', ':', '___EOS___']", "index": 532 }, { "content": " def satisfy(self, axioms, _get_model_clauses=None):\n \"\"\" Produce a state sequence if the symbolic history contains\n one. Returns the sort universes and a sequence of states, or\n None if the history is vacuous. \"\"\"\n\n if _get_model_clauses is None:\n _get_model_clauses = small_model_clauses\n\n# print \"axioms: {}\".format(axioms)\n\n # A model of the post-state embeds a valuation for each time\n # in the history.\n post = and_clauses(self.post,axioms)\n# print \"post: {}\".format(post)\n print \"bounded check {\"\n model = _get_model_clauses(post)\n print \"} bounded check\"\n if model == None:\n# print \"core = {}\".format(unsat_core(post,true_clauses()))\n return None\n\n # we reconstruct the sub-model for each state composing the\n # recorded renamings in reverse order. Here \"renaming\" maps\n # symbols representing a past time onto current time skolems\n renaming,states,maps = {},[],reversed(self.maps)\n while True:\n # ignore all symbols except those representing the given past time\n img = set(renaming[s] for s in renaming if not s.is_skolem())\n ignore = lambda s: self.ignore(s,img,renaming)\n # get the sub-mode for the given past time as a formula\n clauses = clauses_model_to_clauses(post,ignore = ignore, model = model, numerals=use_numerals())\n # map this formula into the past using inverse map\n clauses = rename_clauses(clauses,inverse_map(renaming))\n # remove tautology equalities, TODO: not sure if this is correct here\n clauses = Clauses(\n [f for f in clauses.fmlas if not is_tautology_equality(f)],\n clauses.defs\n )\n states.append(clauses)\n try:\n # update the inverse map by composing it with inverse\n # of the next renaming (in reverse order)\n renaming = compose_maps(next(maps),renaming)\n except StopIteration:\n break\n uvs = model.universes(numerals=use_numerals())\n# print \"uvs: {}\".format(uvs)\n return uvs, [pure_state(clauses) for clauses in reversed(states)]", "metadata": "root.History.satisfy", "header": "['class', 'History', '(', 'object', ')', ':', '___EOS___']", "index": 537 }, { "content": "def use_numerals():\n return iu.use_numerals.get()", "metadata": "root.use_numerals", "header": "['module', '___EOS___']", "index": 587 } ]
[ { "span": "from ivy_utils import UniqueRenamer, union_to_list, list_union, list_diff, IvyError, inverse_map, compose_maps, pretty", "start_line": 30, "start_column": 0, "end_line": 30, "end_column": 118 }, { "span": "from ivy_logic import Variable, Constant, Literal, Atom, Not, And, Or,App, RelationSort, Definition, is_prenex_universal", "start_line": 31, "start_column": 0, "end_line": 31, "end_column": 120 }, { "span": "from ivy_logic_utils import used_symbols_clauses, rename_clauses, clauses_using_symbols, simplify_clauses,\\\n used_variables_clauses, used_constants_clauses, substitute_constants_clause, substitute_constants_clauses, constants_clauses,\\\n relations_clauses, eq_lit, condition_clauses, or_clauses, and_clauses, false_clauses, true_clauses,\\\n formula_to_clauses, clauses_to_formula, formula_to_clauses_tseitin, is_ground_clause, \\\n relations_clause, Clauses, sym_inst, negate_clauses, negate", "start_line": 32, "start_column": 0, "end_line": 36, "end_column": 63 }, { "span": "from ivy_solver import unsat_core, clauses_imply, clauses_imply_formula, clauses_sat, clauses_case, get_model_clauses, clauses_model_to_clauses, get_small_model", "start_line": 37, "start_column": 0, "end_line": 37, "end_column": 160 }, { "span": "import ivy_logic_utils as lu", "start_line": 39, "start_column": 0, "end_line": 39, "end_column": 28 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "Micro", "soft", " ", "Cor", "porat", "ion", ".", " ", "All", " ", "Rig", "hts", " ", "Reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", " ", "Function", "s", " ", "for", " ", "manip", "lua", "ting", " ", "transiti", "on", " ", "relation", "s", " ", "as", " ", "two", "-", "vocab", "ular", "y", " ", "formulas", "\\", "10", ";", "\\", "10", ";", "Update", "s", " ", "represent", " ", "the", " ", "semantics", " ", "of", " ", "action", "s", " ", "and", " ", "state", "s", ".", " ", " ", "Bot", "h", " ", "kinds", " ", "of", "\\", "10", ";", "update", "s", " ", "have", " ", "a", " ", "set", " ", "of", " ", "modifi", "ed", " ", "symbols", ".", " ", "The", " ", "difference", " ", "is", " ", "tha", "t", " ", "action", "\\", "10", ";", "style", " ", "use", "s", " ", "\"", "new", "\"", " ", "version", "s", " ", "of", " ", "the", " ", "symbols", " ", "to", " ", "represent", " ", "the", " ", "post", "-", "state", ",", "\\", "10", ";", "whi", "le", " ", "state", " ", "style", " ", "use", "s", " ", "\"", "old", "\"", " ", "version", " ", "to", " ", "represent", " ", "the", " ", "pre", "-", "state", ".", " ", "In", " ", "a", "\\", "10", ";", "\"", "pure", "\"", " ", "state", ",", " ", "the", " ", "modifi", "es", " ", "set", " ", "is", " ", "\"", "all", "\"", " ", "and", " ", "the", " ", "\"", "old", "\"", " ", "symbols", " ", "are", " ", "not", "\\", "10", ";", "referred", " ", "to", ".", " ", "Tha", "t", " ", "is", ",", " ", "a", " ", "pure", " ", "state", " ", "say", "s", " ", "not", "hing", " ", "abo", "ut", " ", "the", " ", "initial", "\\", "10", ";", "condition", ".", " ", "On", " ", "the", " ", "other", " ", "hand", ",", " ", "the", " ", "state", " ", "of", " ", "a", " ", "procedure", " ", "is", "\\", "10", ";", "\"", "impu", "re", "\".", " ", "The", " ", "initial", " ", "state", " ", "of", " ", "a", " ", "procedure", " ", "has", " ", "an", " ", "empty", " ", "modifi", "es", " ", "set", ",", "\\", "10", ";", "meaning", " ", "mean", " ", "the", " ", "current", " ", "values", " ", "are", " ", "all", " ", "equal", " ", "to", " ", "the", " ", "initial", " ", "values", ".", "\\", "10", ";", "\\", "10", ";", "An", " ", "update", " ", "is", " ", "represent", "ed", " ", "as", " ", "a", " ", "triple", " ", "(", "mod", ",", "tr", ",", "pre", ")", " ", "where", " ", "mod", " ", "is", " ", "a", " ", "list", "\\", "10", ";", "of", " ", "modifi", "ed", " ", "symbols", " ", "(", "or", " ", "\"", "all", "\")", " ", "and", " ", "tr", " ", "is", " ", "a", " ", "two", "-", "vocab", "ular", "y", " ", "transiti", "on", "\\", "10", ";", "relation", ",", " ", "and", " ", "pre", " ", "is", " ", "a", " ", "one", "-", "vocab", "ular", "y", " ", "precondition", ".", " ", "The", " ", "precondition", "\\", "10", ";", "is", " ", "state", "d", " ", "in", " ", "the", " ", "negati", "ve", ",", " ", "so", " ", "tha", "t", " ", "an", " ", "action", " ", "*", "fail", "s", "*", " ", "in", " ", "a", " ", "state", " ", "s", " ", "if", "\\", "10", ";", "st", " ", "/\\\\", " ", "axiom", "s", " ", "/\\\\", " ", "pre", " ", "is", " ", "satisf", "iable", ".", " ", "The", " ", "tr", " ", "and", " ", "pre", " ", "are", " ", "bot", "h", " ", "implicit", "ly", "\\", "10", ";", "existen", "tial", "ly", " ", "quantifi", "ed", " ", "over", " ", "the", " ", "sko", "lem", " ", "symbols", ".", "\\", "10", ";", "\\", "10", ";", "Be", "caus", "e", " ", "pre", " ", "is", " ", "negati", "ve", ",", " ", "we", " ", "say", " ", "tha", "t", " ", "an", " ", "action", " ", "a", " ", "=", " ", "(", "mod", "\\u", "a", ",", "tr", "\\u", "a", ",", "pre", "\\u", "a", ")", "\\", "10", ";", "*", "refine", "s", "*", " ", "(", "is", " ", "a", " ", "safe", " ", "replace", "ment", " ", "for", ")", " ", "an", " ", "action", " ", "b", " ", "=", " ", "(", "mod", "\\u", "b", ",", "tr", "\\u", "b", ",", "pre", "\\u", "b", ")", "\\", "10", ";", "whe", "n", " ", "pre", "\\u", "a", " ", "=>", " ", "pre", "\\u", "b", " ", "and", " ", "frame", "(", "mod", "\\u", "a", ")", " ", "/\\\\", " ", "tr", "\\u", "a", " ", "=>", " ", "frame", "(", "mod", "\\u", "b", ")", " ", "/\\\\", "\\", "10", ";", "tr", "\\u", "b", ".", " ", "Her", "e", ",", " ", "frame", "(", "S", "),", " ", "where", " ", "S", " ", "is", " ", "a", " ", "set", " ", "of", " ", "symbols", ",", " ", "is", " ", "the", " ", "condition", "\\", "10", ";", "tha", "t", " ", "all", " ", "symbols", " ", "*", "not", "*", " ", "in", " ", "S", " ", "are", " ", "preserved", ".", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "iv", "y", "\\u", "utils_", "import_", "Unique", "Rename", "r_", ",_", "uni", "on", "\\u", "to", "\\u", "list_", ",_", "list", "\\u", "union_", ",_", "list", "\\u", "diff_", ",_", "Iv", "y", "Error_", ",_", "inv", "erse", "\\u", "map_", ",_", "compose", "\\u", "maps_", ",_", "pretty_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "iv", "y", "\\u", "logic_", "import_", "Variable_", ",_", "Constant_", ",_", "Literal_", ",_", "Atom_", ",_", "Not_", ",_", "And_", ",_", "Or_", ",_", "App_", ",_", "Relation", "Sort_", ",_", "Definition_", ",_", "is", "\\u", "pren", "ex", "\\u", "universal", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "iv", "y", "\\u", "logic", "\\u", "utils_", "import_", "used", "\\u", "symbols", "\\u", "clauses_", ",_", "rename", "\\u", "clauses_", ",_", "clause", "s", "\\u", "usi", "ng", "\\u", "symbols_", ",_", "simplify", "\\u", "clauses_", ",_", "used", "\\u", "variab", "les", "\\u", "clauses_", ",_", "used", "\\u", "constant", "s", "\\u", "clauses_", ",_", "substitute", "\\u", "constant", "s", "\\u", "clause_", ",_", "substitute", "\\u", "constant", "s", "\\u", "clauses_", ",_", "constant", "s", "\\u", "clauses_", ",_", "relation", "s", "\\u", "clauses_", ",_", "eq", "\\u", "lit_", ",_", "condition", "\\u", "clauses_", ",_", "or", "\\u", "clauses_", ",_", "and", "\\u", "clauses_", ",_", "fal", "se", "\\u", "clauses_", ",_", "true", "\\u", "clauses_", ",_", "formula", "\\u", "to", "\\u", "clauses_", ",_", "clause", "s", "\\u", "to", "\\u", "formula_", ",_", "formula", "\\u", "to", "\\u", "clause", "s", "\\u", "tse", "iti", "n_", ",_", "is", "\\u", "ground", "\\u", "clause_", ",_", "relation", "s", "\\u", "clause_", ",_", "Cla", "uses_", ",_", "sym", "\\u", "inst_", ",_", "negate", "\\u", "clauses_", ",_", "negate", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "iv", "y", "\\u", "solver_", "import_", "unsa", "t", "\\u", "core_", ",_", "clause", "s", "\\u", "impl", "y_", ",_", "clause", "s", "\\u", "impl", "y", "\\u", "formula_", ",_", "clause", "s", "\\u", "sat_", ",_", "clause", "s", "\\u", "case_", ",_", "get", "\\u", "model", "\\u", "clauses_", ",_", "clause", "s", "\\u", "model", "\\u", "to", "\\u", "clauses_", ",_", "get", "\\u", "small", "\\u", "model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "iv", "y", "\\u", "logic_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "iv", "y", "\\u", "logic", "\\u", "utils_", "as_", "lu_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "iv", "y", "\\u", "utils_", "as_", "iu", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "logic", "\\u", "util_", "import_", "is", "\\u", "tau", "tol", "og", "y", "\\u", "equality", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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", ":", " ", "this", " ", "will", " ", "be", " ", "quadratic", " ", "for", " ", "chain", "s", " ", "of", " ", "updates_", "\\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_", "\\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\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "new_", "(_", "sym_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Return", " ", "the", " ", "\"", "new", "\"", " ", "version", " ", "of", " ", "symbol", " ", "\"", "sym", "\",", " ", "tha", "t", " ", "is", ",", " ", "the", " ", "one", "\\", "10", ";", " ", " ", " ", " ", "represent", "ing", " ", "\"", "sym", "\"", " ", "in", " ", "the", " ", "post", "\\u", "state", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "sym_", "._", "prefix_", "(_", "'", "new", "\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "new_", "(_", "sym_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "sym_", "._", "startswith_", "(_", "'", "new", "\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "new", "\\u", "of_", "(_", "sym_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "sym_", "._", "drop", "\\u", "prefix_", "(_", "'", "new", "\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "old_", "(_", "sym_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Return", " ", "the", " ", "\"", "old", "\"", " ", "version", " ", "of", " ", "symbol", " ", "\"", "sym", "\",", " ", "tha", "t", " ", "is", ",", " ", "the", " ", "one", "\\", "10", ";", " ", " ", " ", " ", "represent", "ing", " ", "\"", "sym", "\"", " ", "in", " ", "the", " ", "pre", "\\u", "state", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "sym_", "._", "prefix_", "(_", "'", "old", "\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "old_", "(_", "sym_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "sym_", "._", "startswith_", "(_", "'", "old", "\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "old", "\\u", "of_", "(_", "sym_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "sym_", "._", "drop", "\\u", "prefix_", "(_", "'", "old", "\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "rename_", "(_", "sym_", ",_", "rn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "sym_", "._", "rename_", "(_", "rn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "sko", "lem", "_", "(_", "sym_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Sym", "bol", "s", " ", "with", " ", "\\u\\u", " ", "in", " ", "them", " ", "in", " ", "the", " ", "TR", " ", "are", " ", "consider", "d", " ", "to", " ", "be", " ", "implicit", "ly", " ", "existen", "tial", "ly", " ", "quantifi", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "sym_", "._", "contains_", "(_", "'\\u\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "null", "\\u", "update_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "[_", "]_", ",_", "true", "\\u", "clauses_", "(_", ")_", ",_", "fal", "se", "\\u", "clauses_", "(_", ")_", ")_", "\\u\\u\\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_", "pure", "\\u", "state_", "(_", "clauses_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "None_", ",_", "clauses_", ",_", "fal", "se", "\\u", "clauses_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "pure", "\\u", "state_", "(_", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "state_", "[_", "0_", "]_", "==_", "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_", "top", "\\u", "state_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "pure", "\\u", "state_", "(_", "true", "\\u", "clauses_", "(_", ")_", ")_", "\\u\\u\\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_", "bottom", "\\u", "state_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "pure", "\\u", "state_", "(_", "fal", "se", "\\u", "clauses_", "(_", ")_", ")_", "\\u\\u\\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_", "state", "\\u", "postc", "ond", "_", "(_", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "state_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "state", "\\u", "precon", "d_", "(_", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "state_", "[_", "2_", "]_", "\\u\\u\\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_", "state", "\\u", "to", "\\u", "action_", "(_", "update_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "convert", " ", "from", " ", "the", " ", "\"", "state", "\"", " ", "style", " ", "to", " ", "the", " ", "\"", "action", "\"", " ", "style", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "updated_", ",_", "postc", "ond", "_", ",_", "pre_", "=_", "update_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "postc", "ond", "_", ",_", "pre_", "=_", "cla", "usi", "fy_", "(_", "postc", "ond", "_", ")_", ",_", "cla", "usi", "fy_", "(_", "pre_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rena", "ming", "_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "s_", "in_", "updated_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rena", "ming", "_", "[_", "s_", "]_", "=_", "new_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "s_", "in_", "used", "\\u", "symbols", "\\u", "clauses_", "(_", "postc", "ond", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "is", "\\u", "old_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rena", "ming", "_", "[_", "s_", "]_", "=_", "old", "\\u", "of_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "updated_", ",_", "rename", "\\u", "clauses_", "(_", "postc", "ond", "_", ",_", "rena", "ming", "_", ")_", ",_", "pre_", ")_", "\\u\\u\\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_", "action", "\\u", "to", "\\u", "state_", "(_", "update_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "convert", " ", "from", " ", "the", " ", "\"", "action", "\"", " ", "style", " ", "to", " ", "the", " ", "\"", "state", "\"", " ", "style", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "updated_", ",_", "tr_", ",_", "pre_", "=_", "update_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rena", "ming", "_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "s_", "in_", "updated_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rena", "ming", "_", "[_", "s_", "]_", "=_", "old_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "s_", "in_", "used", "\\u", "symbols", "\\u", "clauses_", "(_", "tr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "is", "\\u", "new_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rena", "ming", "_", "[_", "s_", "]_", "=_", "new", "\\u", "of_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "updated_", ",_", "rename", "\\u", "clauses_", "(_", "tr_", ",_", "rena", "ming", "_", ")_", ",_", "pre_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "frame", "\\u", "constraint_", "(_", "update_", ",_", "relations_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Return", " ", "a", " ", "clause", " ", "list", " ", "constrain", "ing", " ", "all", " ", "update", "d", " ", "symbols", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "keep", " ", "thei", "r", " ", "previ", "ous", " ", "values", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clauses_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "sym_", "in_", "update_", "[_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "sym_", "in_", "relations_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arity_", "=_", "relations_", "[_", "sym_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vs_", "=_", "[_", "Variable_", "(_", "\"", "V", "{}\"_", "._", "format_", "(_", "i_", ")_", ")_", "for_", "i_", "in_", "range_", "(_", "0_", ",_", "arity_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lit", "1_", "=_", "Literal_", "(_", "1_", ",_", "Atom_", "(_", "sym_", ",_", "vs_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lit", "2_", "=_", "Literal_", "(_", "1_", ",_", "Atom_", "(_", "new_", "(_", "sym_", ")_", ",_", "vs_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clauses_", "+=_", "[_", "[_", "~_", "lit", "1_", ",_", "lit", "2_", "]_", ",_", "[_", "lit", "1_", ",_", "~_", "lit", "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 ", " _", "clauses_", "._", "append_", "(_", "[_", "eq", "\\u", "lit_", "(_", "Constant_", "(_", "sym_", ")_", ",_", "Constant_", "(_", "new_", "(_", "sym_", ")_", ")_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Cla", "uses_", "(_", "clauses_", ")_", "\\u\\u\\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_", "frame", "\\u", "def_", "(_", "sym_", ",_", "op_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Add", " ", "the", " ", "condition", " ", "tha", "t", " ", "sym", " ", "remains", " ", "unchanged", " ", "to", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "transiti", "on", " ", "relation", " ", "(", "usi", "ng", " ", "op", " ", "=", " ", "{", "new", ",", "old", "})", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lhs_", "=_", "sym", "\\u", "inst_", "(_", "op_", "(_", "sym_", ")_", "if_", "op_", "is_", "new_", "else_", "sym_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rhs_", "=_", "sym", "\\u", "inst_", "(_", "sym_", "if_", "op_", "is_", "new_", "else_", "op_", "(_", "sym_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df", "n_", "=_", "Definition_", "(_", "lhs_", ",_", "rhs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "df", "n_", "\\u\\u\\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_", "frame_", "(_", "updated_", ",_", "relations_", ",_", "op_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Return", " ", "a", " ", "clause", " ", "list", " ", "constrain", "ing", " ", "all", " ", "update", "d", " ", "symbols", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "keep", " ", "thei", "r", " ", "op", " ", "values", ",", " ", "for", " ", "op", " ", "=", " ", "new", ",", "old", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Cla", "uses_", "(_", "[_", "]_", ",_", "[_", "frame", "\\u", "def_", "(_", "sym_", ",_", "op_", ")_", "for_", "sym_", "in_", "updated_", "]_", ")_", "\\u\\u\\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_", "symbol", "\\u", "frame", "\\u", "cond_", "(_", "sym_", ",_", "sig_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Return", " ", "transiti", "on", " ", "relation", " ", "impl", "ying", " ", "tha", "t", " ", "sym", " ", "remains", " ", "unchanged", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Cla", "uses_", "(_", "[_", "]_", ",_", "[_", "frame", "\\u", "def_", "(_", "sym_", ",_", "new_", ")_", "]_", ")_", "\\u\\u\\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_", "frame", "\\u", "update_", "(_", "update_", ",_", "in", "\\u", "scope_", ",_", "sig_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Modif", "y", " ", "an", " ", "update", " ", "so", " ", "all", " ", "symbols", " ", "in", " ", "\"", "in", "\\u", "scope", "\"", " ", "are", " ", "on", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "update", " ", "list", ",", " ", "prese", "rvi", "ng", " ", "semantics", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "updated_", ",_", "clauses_", ",_", "pre_", "=_", "update_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mode", "d_", "=_", "set_", "(_", "updated_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df", "ns_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "sym_", "in_", "in", "\\u", "scope_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "sym_", "not_", "in_", "mode", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "updated_", "._", "append_", "(_", "sym_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df", "ns_", "._", "append_", "(_", "frame", "\\u", "def_", "(_", "sym_", ",_", "new_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "updated_", ",_", "and", "\\u", "clauses_", "(_", "clauses_", ",_", "Cla", "uses_", "(_", "[_", "]_", ",_", "df", "ns_", ")_", ")_", ",_", "pre_", ")_", "\\u\\u\\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_", "diff", "\\u", "frame_", "(_", "update", "d1_", ",_", "update", "d2_", ",_", "relations_", ",_", "op_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "update", "d1_", "==_", "None_", "or_", "update", "d2_", "==_", "None_", ":_", "return_", "Cla", "uses_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "updated_", "=_", "list", "\\u", "diff_", "(_", "update", "d2_", ",_", "update", "d1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "frame_", "(_", "updated_", ",_", "relations_", ",_", "op_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "d\\u", "join_", "(_", "update", "d1_", ",_", "update", "d2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "update", "d1_", "==_", "None_", "or_", "update", "d1_", "==_", "None_", ":_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "list", "\\u", "union_", "(_", "update", "d1_", ",_", "update", "d2_", ")_", "\\u\\u\\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_", "join_", "(_", "s1_", ",_", "s2_", ",_", "relations_", ",_", "op_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "u1_", ",_", "c1_", ",_", "p1_", "=_", "s1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u2_", ",_", "c2_", ",_", "p2_", "=_", "s2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df", "12_", "=_", "diff", "\\u", "frame_", "(_", "u1_", ",_", "u2_", ",_", "relations_", ",_", "op_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df", "21_", "=_", "diff", "\\u", "frame_", "(_", "u2_", ",_", "u1_", ",_", "relations_", ",_", "op_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c1_", "=_", "and", "\\u", "clauses_", "(_", "c1_", ",_", "df", "12_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c2_", "=_", "and", "\\u", "clauses_", "(_", "c2_", ",_", "df", "21_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p1_", "=_", "and", "\\u", "clauses_", "(_", "p1_", ",_", "df", "12_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p2_", "=_", "and", "\\u", "clauses_", "(_", "p2_", ",_", "df", "21_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u_", "=_", "update", "d\\u", "join_", "(_", "u1_", ",_", "u2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "or", "\\u", "clauses_", "(_", "c1_", ",_", "c2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "or", "\\u", "clauses_", "(_", "p1_", ",_", "p2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "u_", ",_", "c_", ",_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Counter", "Example_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Counter", "Example_", "(_", "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_", ",_", "clauses_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "clauses_", "=_", "clauses_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Counter", "Example_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "nonzero\\u", "\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clause", "s", "\\u", "impl", "y", "\\u", "formula", "\\u", "ce", "x_", "(_", "clauses_", ",_", "fm", "la_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "clause", "s", "\\u", "impl", "y", "\\u", "formula_", "(_", "clauses_", ",_", "fm", "la_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Counter", "Example_", "(_", "conj", "oin", "_", "(_", "clauses_", ",_", "negate", "\\u", "clauses_", "(_", "formula", "\\u", "to", "\\u", "clauses_", "(_", "fm", "la_", ")_", ")_", ")_", ")_", "\\u\\u\\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_", "implies", "_", "(_", "s1_", ",_", "s2_", ",_", "axiom", "s_", ",_", "relations_", ",_", "op_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "u1_", ",_", "c1_", ",_", "p1_", "=_", "s1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u2_", ",_", "c2_", ",_", "p2_", "=_", "s2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "u1_", "==_", "None_", "and_", "u2_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", "c1", ":", " ", "{}", "\".", "format", "(", "c1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", "axiom", "s", ":", " ", "{}", "\".", "format", "(", "axiom", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", "df", ":", " ", "{}", "\".", "format", "(", "diff", "\\u", "frame", "(", "u1", ",", "u2", ",", "relation", "s", ",", "op", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "c1_", "=_", "and", "\\u", "clauses_", "(_", "c1_", ",_", "axiom", "s_", ",_", "diff", "\\u", "frame_", "(_", "u1_", ",_", "u2_", ",_", "relations_", ",_", "op_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "c2_", ",_", "Cla", "uses_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "c2_", "._", "is", "\\u", "universal", "\\u", "first", "\\u", "order_", "(_", ")_", "or_", "not_", "p2_", "._", "is", "\\u", "universal", "\\u", "first", "\\u", "order_", "(_", ")_", ":_", "\\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_", "c2_", "=_", "and", "\\u", "clauses_", "(_", "c2_", ",_", "diff", "\\u", "frame_", "(_", "u2_", ",_", "u1_", ",_", "relations_", ",_", "op_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "clause", "s", "\\u", "impl", "y_", "(_", "p1_", ",_", "p2_", ")_", "and_", "clause", "s", "\\u", "impl", "y_", "(_", "c1_", ",_", "c2_", ")_", "\\u\\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_", "is", "\\u", "pren", "ex", "\\u", "universal", "_", "(_", "c2_", ")_", "or_", "not_", "is", "\\u", "pren", "ex", "\\u", "universal", "_", "(_", "p2_", ")_", ":_", "\\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_", "c2_", "=_", "And_", "(_", "c2_", ",_", "clause", "s", "\\u", "to", "\\u", "formula_", "(_", "diff", "\\u", "frame_", "(_", "u2_", ",_", "u1_", ",_", "relations_", ",_", "op_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "clause", "s", "\\u", "impl", "y", "\\u", "formula", "\\u", "ce", "x_", "(_", "p1_", ",_", "p2_", ")_", "and_", "clause", "s", "\\u", "impl", "y", "\\u", "formula", "\\u", "ce", "x_", "(_", "c1_", ",_", "c2_", ")_", "\\u\\u\\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_", "implies", "\\u", "state_", "(_", "s1_", ",_", "s2_", ",_", "axiom", "s_", ",_", "relations_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "implies", "_", "(_", "s1_", ",_", "s2_", ",_", "axiom", "s_", ",_", "relations_", ",_", "old_", ")_", "\\u\\u\\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_", "implies", "\\u", "action_", "(_", "s1_", ",_", "s2_", ",_", "axiom", "s_", ",_", "relations_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "implies", "_", "(_", "s1_", ",_", "s2_", ",_", "axiom", "s_", ",_", "relations_", ",_", "new_", ")_", "\\u\\u\\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_", "join", "\\u", "state_", "(_", "s1_", ",_", "s2_", ",_", "relations_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "join_", "(_", "cla", "usi", "fy", "\\u", "state_", "(_", "s1_", ")_", ",_", "cla", "usi", "fy", "\\u", "state_", "(_", "s2_", ")_", ",_", "relations_", ",_", "old_", ")_", "\\u\\u\\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_", "join", "\\u", "action_", "(_", "s1_", ",_", "s2_", ",_", "relations_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "join_", "(_", "s1_", ",_", "s2_", ",_", "relations_", ",_", "new_", ")_", "\\u\\u\\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_", "condition", "\\u", "update", "\\u", "on", "\\u", "fm", "la_", "(_", "update_", ",_", "fm", "la_", ",_", "relations_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Give", "n", " ", "an", " ", "update", ",", " ", "return", " ", "an", " ", "update", " ", "condition", "ed", " ", "on", " ", "fm", "la", ".", " ", "Ma", "yb", "e", " ", "an", " ", "\"", "else", "\"", " ", "wou", "ld", "\\", "10", ";", " ", " ", " ", " ", "be", " ", "usef", "ul", " ", "too", " ", ":-", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "updated_", ",_", "if", "\\u", "clauses_", ",_", "if", "\\u", "pre_", "=_", "update_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else", "\\u", "clauses_", "=_", "update", "\\u", "frame", "\\u", "constraint_", "(_", "update_", ",_", "relations_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if", "\\u", "clauses_", "=_", "condition", "\\u", "clauses_", "(_", "if", "\\u", "clauses_", ",_", "fm", "la_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else", "\\u", "clauses_", "=_", "condition", "\\u", "clauses_", "(_", "else", "\\u", "clauses_", ",_", "Not_", "(_", "fm", "la_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", " ", " ", " ", "print", " ", "\"", "if", "\\u", "clause", "s", ":", " ", "%", "s", "\"", " ", "%", " ", "if", "\\u", "clauses_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", "print", " ", "\"", "else", "\\u", "clause", "s", ":", " ", "%", "s", "\"", " ", "%", " ", "else", "\\u", "clauses_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "updated_", ",_", "(_", "and", "\\u", "clauses_", "(_", "if", "\\u", "clauses_", ",_", "else", "\\u", "clauses_", ")_", ")_", ",_", "if", "\\u", "pre_", "\\u\\u\\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_", "rename", "\\u", "distinct_", "(_", "clause", "s1_", ",_", "clause", "s2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "rename", " ", "sko", "lem", "s", " ", "in", " ", "clause", "s1", " ", "so", " ", "the", "y", " ", "don", "'", "t", " ", "occur", " ", "in", " ", "clause", "s2", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", "rename", "\\u", "distinct", " ", "clause", "s1", " ", "=", " ", "{}", "\".", "format", "(", "clause", "s1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", "rename", "\\u", "distinct", " ", "clause", "s2", " ", "=", " ", "{", "!", "r", "}\"", ".", "format", "(", "clause", "s2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "used", "1_", "=_", "used", "\\u", "symbols", "\\u", "clauses_", "(_", "clause", "s1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "used", "2_", "=_", "used", "\\u", "symbols", "\\u", "clauses_", "(_", "clause", "s2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rn_", "=_", "Unique", "Rename", "r_", "(_", "''_", ",_", "used", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "map", "1_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "s_", "in_", "used", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "is", "\\u", "sko", "lem", "_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "map", "1_", "[_", "s_", "]_", "=_", "rename_", "(_", "s_", ",_", "rn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "rename", "\\u", "clauses_", "(_", "clause", "s1_", ",_", "map", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compose", "\\u", "updates_", "(_", "update", "1_", ",_", "axiom", "s_", ",_", "update", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "update", "d1_", ",_", "clause", "s1_", ",_", "pre", "1_", "=_", "update", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "d2_", ",_", "clause", "s2_", ",_", "pre", "2_", "=_", "update", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clause", "s2_", "=_", "rename", "\\u", "distinct_", "(_", "clause", "s2_", ",_", "clause", "s1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pre", "2_", "=_", "rename", "\\u", "distinct_", "(_", "pre", "2_", ",_", "clause", "s1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", "clause", "s2", " ", "=", " ", "{}", "\".", "format", "(", "clause", "s2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "us", "1_", "=_", "set_", "(_", "update", "d1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "us", "2_", "=_", "set_", "(_", "update", "d2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mid_", "=_", "us", "1_", "._", "intersection_", "(_", "us", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mid", "\\u", "ax_", "=_", "clause", "s", "\\u", "usi", "ng", "\\u", "symbols_", "(_", "mid_", ",_", "axiom", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "used_", "=_", "used", "\\u", "symbols", "\\u", "clauses_", "(_", "and", "\\u", "clauses_", "(_", "clause", "s1_", ",_", "clause", "s2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rn_", "=_", "Unique", "Rename", "r_", "(_", "'\\u", "\\u", "m", "\\u'_", ",_", "used_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "map", "1_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "map", "2_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "v_", "in_", "update", "d1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "map", "2_", "[_", "v_", "]_", "=_", "new_", "(_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "mv_", "in_", "mid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mv", "f_", "=_", "rename_", "(_", "mv_", ",_", "rn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "map", "1_", "[_", "new_", "(_", "mv_", ")_", "]_", "=_", "mv", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "map", "2_", "[_", "mv_", "]_", "=_", "mv", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "clause", "s1_", "=_", "rename", "\\u", "clauses_", "(_", "clause", "s1_", ",_", "map", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "clauses_", "=_", "and", "\\u", "clauses_", "(_", "clause", "s1_", ",_", "rename", "\\u", "clauses_", "(_", "and", "\\u", "clauses_", "(_", "clause", "s2_", ",_", "mid", "\\u", "ax_", ")_", ",_", "map", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "updated_", "=_", "list_", "(_", "us", "1_", "._", "union_", "(_", "us", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", "pre", "1", " ", "bef", "ore", " ", "=", " ", "{}", "\".", "format", "(", "pre", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "pre", "1_", "=_", "and", "\\u", "clauses_", "(_", "pre", "1_", ",_", "diff", "\\u", "frame_", "(_", "update", "d1_", ",_", "update", "d2_", ",_", "None_", ",_", "new_", ")_", ")_", "#", " ", "keep", " ", "track", " ", "of", " ", "post", "-", "state", " ", "of", " ", "assertion", " ", "failure_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", "pre", "1", " ", "=", " ", "{}", "\".", "format", "(", "pre", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "pre_", "=_", "or", "\\u", "clauses_", "(_", "pre", "1_", ",_", "and", "\\u", "clauses_", "(_", "clause", "s1_", ",_", "rename", "\\u", "clauses_", "(_", "and", "\\u", "clauses_", "(_", "pre", "2_", ",_", "mid", "\\u", "ax_", ")_", ",_", "map", "2_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", "new", "\\u", "pre", " ", "=", " ", "{}", "\".", "format", "(", "new", "\\u", "pre", ")_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "(_", "new", "\\u", "updated_", ",_", "new", "\\u", "clauses_", ",_", "new", "\\u", "pre_", ")_", "\\u\\u\\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_", "exist", "\\u", "quant", "\\u", "map_", "(_", "syms_", ",_", "clauses_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "used_", "=_", "used", "\\u", "symbols", "\\u", "clauses_", "(_", "clauses_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rn_", "=_", "Unique", "Rename", "r_", "(_", "'\\u\\u'_", ",_", "used_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "map", "1_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "s_", "in_", "syms_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "map", "1_", "[_", "s_", "]_", "=_", "rename_", "(_", "s_", ",_", "rn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "map", "1_", ",_", "rename", "\\u", "clauses_", "(_", "clauses_", ",_", "map", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "exist", "\\u", "quant", "_", "(_", "syms_", ",_", "clauses_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "map", "1_", ",_", "res_", "=_", "exist", "\\u", "quant", "\\u", "map_", "(_", "syms_", ",_", "clauses_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "conj", "oin", "_", "(_", "clause", "s1_", ",_", "clause", "s2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Con", "join", " ", "clause", " ", "sets", ",", " ", "tak", "ing", " ", "int", "o", " ", "account", " ", "sko", "lem", "s", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "and", "\\u", "clauses_", "(_", "clause", "s1_", ",_", "rename", "\\u", "distinct_", "(_", "clause", "s2_", ",_", "clause", "s1_", ")_", ")_", "\\u\\u\\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_", "constrain", "\\u", "state_", "(_", "upd", "_", ",_", "fm", "la_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "upd", "_", "[_", "0_", "]_", ",_", "and", "\\u", "clauses_", "(_", "upd", "_", "[_", "1_", "]_", ",_", "formula", "\\u", "to", "\\u", "clauses_", "(_", "fm", "la_", ")_", ")_", ",_", "upd", "_", "[_", "2_", "]_", ")_", "\\u\\u\\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_", "hide_", "(_", "syms_", ",_", "update_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "syms_", "=_", "set_", "(_", "syms_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "syms_", "._", "update_", "(_", "new_", "(_", "s_", ")_", "for_", "s_", "in_", "update_", "[_", "0_", "]_", "if_", "s_", "in_", "syms_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "updated_", "=_", "[_", "s_", "for_", "s_", "in_", "update_", "[_", "0_", "]_", "if_", "s_", "not_", "in_", "syms_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "tr_", "=_", "exist", "\\u", "quant", "_", "(_", "syms_", ",_", "update_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "pre_", "=_", "exist", "\\u", "quant", "_", "(_", "syms_", ",_", "update_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "new", "\\u", "updated_", ",_", "new", "\\u", "tr_", ",_", "new", "\\u", "pre_", ")_", "\\u\\u\\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_", "hide", "\\u", "state_", "(_", "syms_", ",_", "update_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "syms_", "=_", "set_", "(_", "syms_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "update_", "[_", "0_", "]_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "syms_", "._", "update_", "(_", "old_", "(_", "s_", ")_", "for_", "s_", "in_", "update_", "[_", "0_", "]_", "if_", "s_", "in_", "syms_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "updated_", "=_", "[_", "s_", "for_", "s_", "in_", "update_", "[_", "0_", "]_", "if_", "s_", "not_", "in_", "syms_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "updated_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "\\u", "tr_", "=_", "exist", "\\u", "quant", "_", "(_", "syms_", ",_", "update_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "pre_", "=_", "exist", "\\u", "quant", "_", "(_", "syms_", ",_", "update_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "new", "\\u", "updated_", ",_", "new", "\\u", "tr_", ",_", "new", "\\u", "pre_", ")_", "\\u\\u\\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_", "hide", "\\u", "state", "\\u", "map_", "(_", "syms_", ",_", "update_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "syms_", "=_", "set_", "(_", "syms_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "update_", "[_", "0_", "]_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "syms_", "._", "update_", "(_", "old_", "(_", "s_", ")_", "for_", "s_", "in_", "update_", "[_", "0_", "]_", "if_", "s_", "in_", "syms_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "updated_", "=_", "[_", "s_", "for_", "s_", "in_", "update_", "[_", "0_", "]_", "if_", "s_", "not_", "in_", "syms_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "updated_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tr", "map_", ",_", "new", "\\u", "tr_", "=_", "exist", "\\u", "quant", "\\u", "map_", "(_", "syms_", ",_", "update_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "pre_", "=_", "exist", "\\u", "quant", "_", "(_", "syms_", ",_", "update_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "tr", "map_", ",_", "(_", "new", "\\u", "updated_", ",_", "new", "\\u", "tr_", ",_", "new", "\\u", "pre_", ")_", "\\u\\u\\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_", "subst", "\\u", "action_", "(_", "update_", ",_", "subst_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "subst_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "syms_", "=_", "dict_", "(_", "subst_", "._", "iteritems_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "syms_", "._", "update_", "(_", "(_", "new_", "(_", "s_", ")_", ",_", "new_", "(_", "syms_", "[_", "s_", "]_", ")_", ")_", "for_", "s_", "in_", "update_", "[_", "0_", "]_", "if_", "s_", "in_", "syms_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "syms_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "updated_", "=_", "[_", "subst_", "._", "get_", "(_", "s_", ",_", "s_", ")_", "for_", "s_", "in_", "update_", "[_", "0_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "tr_", "=_", "rename", "\\u", "clauses_", "(_", "update_", "[_", "1_", "]_", ",_", "syms_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "pre_", "=_", "rename", "\\u", "clauses_", "(_", "update_", "[_", "2_", "]_", ",_", "syms_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "new", "\\u", "updated_", ",_", "new", "\\u", "tr_", ",_", "new", "\\u", "pre_", ")_", "\\u\\u\\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_", "forward", "\\u", "image", "\\u", "map_", "(_", "pre", "\\u", "state_", ",_", "axiom", "s_", ",_", "update_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "updated_", ",_", "clauses_", ",_", "\\u", "precon", "d_", "=_", "update_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", "transiti", "on", "\\u", "relation", ":", " ", "{}", "\".", "format", "(", "clause", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "pre", "\\u", "ax_", "=_", "clause", "s", "\\u", "usi", "ng", "\\u", "symbols_", "(_", "updated_", ",_", "axiom", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pre_", "=_", "conj", "oin", "_", "(_", "pre", "\\u", "state_", ",_", "pre", "\\u", "ax_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "map", "1_", ",_", "res_", "=_", "exist", "\\u", "quant", "\\u", "map_", "(_", "updated_", ",_", "conj", "oin", "_", "(_", "pre_", ",_", "clauses_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "rename", "\\u", "clauses_", "(_", "res_", ",_", "dict_", "(_", "(_", "new_", "(_", "x_", ")_", ",_", "x_", ")_", "for_", "x_", "in_", "updated_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", " ", " ", " ", "print", " ", "\"", "bef", "ore", " ", "simp", ":", " ", "%", "s", "\"", " ", "%", " ", "res_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "res", " ", "=", " ", "simplify", "\\u", "clause", "s", "(", "res", ")_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "map", "1_", ",_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "forward", "\\u", "image_", "(_", "pre", "\\u", "state_", ",_", "axiom", "s_", ",_", "update_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "map", "1_", ",_", "res_", "=_", "forward", "\\u", "image", "\\u", "map_", "(_", "pre", "\\u", "state_", ",_", "axiom", "s_", ",_", "update_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "action", "\\u", "failure_", "(_", "action_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "upd", "_", ",_", "tr_", ",_", "pre_", "=_", "action_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "upd", "_", ",_", "pre_", ",_", "true", "\\u", "clauses_", "(_", ")_", "\\u\\u\\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_", "Action", "Failed_", "(_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Action", "Failed_", "(_", "Exception_", ")_", ":_", "\\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_", ",_", "clauses_", ",_", "trans_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "clauses_", "=_", "clauses_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "trans_", "=_", "trans_", "\\u\\u\\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_", "cla", "usi", "fy_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "f_", "if_", "isinstance_", "(_", "f_", ",_", "Cla", "uses_", ")_", "else_", "formula", "\\u", "to", "\\u", "clauses_", "(_", "f_", ")_", "\\u\\u\\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_", "cla", "usi", "fy", "\\u", "state_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "upd", "_", ",_", "tr_", ",_", "pre_", "=_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "upd", "_", ",_", "cla", "usi", "fy_", "(_", "tr_", ")_", ",_", "cla", "usi", "fy_", "(_", "pre_", ")_", ")_", "\\u\\u\\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_", "remove", "\\u", "tau", "t", "\\u", "eqs", "\\u", "clauses_", "(_", "clauses_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Cla", "uses_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "f_", "for_", "f_", "in_", "clauses_", "._", "fm", "las", "_", "if_", "not_", "is", "\\u", "tau", "tol", "og", "y", "\\u", "equality", "_", "(_", "f_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "clauses_", "._", "defs_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "extract", "\\u", "pre", "\\u", "post", "\\u", "model_", "(_", "clauses_", ",_", "model_", ",_", "updated_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rena", "ming", "_", "=_", "dict_", "(_", "(_", "v_", ",_", "new_", "(_", "v_", ")_", ")_", "for_", "v_", "in_", "updated_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ignore_", "=_", "lambda_", "s_", ":_", "s_", "._", "is", "\\u", "sko", "lem", "_", "(_", ")_", "or_", "is", "\\u", "new_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pre", "\\u", "clauses_", "=_", "clause", "s", "\\u", "model", "\\u", "to", "\\u", "clauses_", "(_", "clauses_", ",_", "ignore_", "=_", "ignore_", ",_", "model_", "=_", "model_", ",_", "numeral", "s_", "=_", "use", "\\u", "numeral", "s_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ignore_", "=_", "lambda_", "s_", ":_", "s_", "._", "is", "\\u", "sko", "lem", "_", "(_", ")_", "or_", "(_", "not_", "is", "\\u", "new_", "(_", "s_", ")_", "and_", "s_", "in_", "rena", "ming", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post", "\\u", "clauses_", "=_", "clause", "s", "\\u", "model", "\\u", "to", "\\u", "clauses_", "(_", "clauses_", ",_", "ignore_", "=_", "ignore_", ",_", "model_", "=_", "model_", ",_", "numeral", "s_", "=_", "use", "\\u", "numeral", "s_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post", "\\u", "clauses_", "=_", "rename", "\\u", "clauses_", "(_", "post", "\\u", "clauses_", ",_", "inv", "erse", "\\u", "map_", "(_", "rena", "ming", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "map_", "(_", "remove", "\\u", "tau", "t", "\\u", "eqs", "\\u", "clauses_", ",_", "(_", "pre", "\\u", "clauses_", ",_", "post", "\\u", "clauses_", ")_", ")_", "\\u\\u\\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_", "compose", "\\u", "state", "\\u", "action_", "(_", "state_", ",_", "axiom", "s_", ",_", "action_", ",_", "check_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Compose", " ", "a", " ", "state", " ", "and", " ", "an", " ", "action", ",", " ", "return", "ing", " ", "a", " ", "state", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", "state", ":", " ", "{}", "\".", "format", "(", "state", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", "action", ":", " ", "{}", "\".", "format", "(", "action", ")_", "\\u\\u\\uNL\\u\\u\\u_", "su_", ",_", "sc_", ",_", "sp_", "=_", "state_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "au_", ",_", "ac_", ",_", "ap_", "=_", "action_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sc_", ",_", "sp_", "=_", "cla", "usi", "fy_", "(_", "sc_", ")_", ",_", "cla", "usi", "fy_", "(_", "sp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "check_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pre", "\\u", "test_", "=_", "and", "\\u", "clauses_", "(_", "and", "\\u", "clauses_", "(_", "sc_", ",_", "ap_", ")_", ",_", "axiom", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "=_", "small", "\\u", "model", "\\u", "clauses_", "(_", "pre", "\\u", "test_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "model_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "trans_", "=_", "extract", "\\u", "pre", "\\u", "post", "\\u", "model_", "(_", "pre", "\\u", "test_", ",_", "model_", ",_", "au_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post", "\\u", "updated_", "=_", "[_", "new_", "(_", "s_", ")_", "for_", "s_", "in_", "au_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pre", "\\u", "test_", "=_", "exist", "\\u", "quant", "_", "(_", "post", "\\u", "updated_", ",_", "pre", "\\u", "test_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Action", "Failed_", "(_", "pre", "\\u", "test_", ",_", "trans_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "su_", "!=_", "None_", ":_", "#", " ", "none", " ", "means", " ", "all", " ", "mode", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ssu", "_", "=_", "set_", "(_", "su_", ")_", "#", " ", "symbols", " ", "alr", "ead", "y", " ", "modifi", "ed", " ", "in", " ", "state_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rn_", "=_", "dict_", "(_", "(_", "x_", ",_", "old_", "(_", "x_", ")_", ")_", "for_", "x_", "in_", "au_", "if_", "x_", "not_", "in_", "ssu", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sc_", "=_", "rename", "\\u", "clauses_", "(_", "sc_", ",_", "rn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ac_", "=_", "rename", "\\u", "clauses_", "(_", "ac_", ",_", "rn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "su_", "=_", "list_", "(_", "su_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uni", "on", "\\u", "to", "\\u", "list_", "(_", "su_", ",_", "au_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "img_", "=_", "forward", "\\u", "image_", "(_", "sc_", ",_", "axiom", "s_", ",_", "action_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", " ", " ", " ", "print", " ", "\"", "compose", ":", " ", "{}", "\".", "format", "((", "su", ",", "img", ",", "sp", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "(_", "su_", ",_", "img_", ",_", "sp_", ")_", "\\u\\u\\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_", "reverse", "\\u", "image_", "(_", "post", "\\u", "state_", ",_", "axiom", "s_", ",_", "update_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "updated_", ",_", "clauses_", ",_", "\\u", "precon", "d_", "=_", "update_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post", "\\u", "ax_", "=_", "clause", "s", "\\u", "usi", "ng", "\\u", "symbols_", "(_", "updated_", ",_", "axiom", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post", "\\u", "clauses_", "=_", "conj", "oin", "_", "(_", "post", "\\u", "state_", ",_", "post", "\\u", "ax_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post", "\\u", "clauses_", "=_", "rename", "\\u", "clauses_", "(_", "post", "\\u", "clauses_", ",_", "dict_", "(_", "(_", "x_", ",_", "new_", "(_", "x_", ")_", ")_", "for_", "x_", "in_", "updated_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post", "\\u", "updated_", "=_", "[_", "new_", "(_", "s_", ")_", "for_", "s_", "in_", "updated_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "exist", "\\u", "quant", "_", "(_", "post", "\\u", "updated_", ",_", "conj", "oin", "_", "(_", "clauses_", ",_", "post", "\\u", "clauses_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "res", " ", "=", " ", "simplify", "\\u", "clause", "s", "(", "res", ")_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "interp", "ola", "nt_", "(_", "clause", "s1_", ",_", "clause", "s2_", ",_", "axiom", "s_", ",_", "interprete", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", "interp", "ola", "nt", " ", "clause", "s1", "={}", " ", "clause", "s2", "={}", "\".", "format", "(", "clause", "s1", ",", "clause", "s2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", "axiom", "s", " ", "=", " ", "{}", "\".", "format", "(", "axiom", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "foo_", "=_", "and", "\\u", "clauses_", "(_", "clause", "s1_", ",_", "axiom", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clause", "s2_", "=_", "simplify", "\\u", "clauses_", "(_", "clause", "s2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "core_", "=_", "unsa", "t", "\\u", "core_", "(_", "clause", "s2_", ",_", "foo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "core_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", "core", ":", " ", "%", "s", "\"", " ", "%", " ", "core_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "core_", ",_", "interp", "\\u", "from", "\\u", "unsa", "t", "\\u", "core_", "(_", "clause", "s2_", ",_", "foo_", ",_", "core_", ",_", "interprete", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "forward", "\\u", "interp", "ola", "nt_", "(_", "pre", "\\u", "state_", ",_", "update_", ",_", "post", "\\u", "state_", ",_", "axiom", "s_", ",_", "interprete", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "interp", "ola", "nt_", "(_", "forward", "\\u", "image_", "(_", "pre", "\\u", "state_", ",_", "axiom", "s_", ",_", "update_", ")_", ",_", "post", "\\u", "state_", ",_", "axiom", "s_", ",_", "interprete", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "reverse", "\\u", "interp", "ola", "nt", "\\u", "case_", "(_", "post", "\\u", "state_", ",_", "update_", ",_", "pre", "\\u", "state_", ",_", "axiom", "s_", ",_", "interprete", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pre_", "=_", "reverse", "\\u", "image_", "(_", "post", "\\u", "state_", ",_", "axiom", "s_", ",_", "update_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pre", "\\u", "case_", "=_", "clause", "s", "\\u", "case_", "(_", "pre_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", " ", " ", " ", "print", " ", "\"", "pre", "\\u", "case", "1", ":", " ", "{}", "\".", "format", "(", "pre", "\\u", "case", ")_", "\\u\\u\\uNL\\u\\u\\u_", "pre", "\\u", "case_", "=_", "[_", "cl_", "for_", "cl_", "in_", "pre", "\\u", "case_", "if_", "len_", "(_", "cl_", ")_", "<=_", "1_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "is", "\\u", "ground", "\\u", "clause_", "(_", "cl_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "not_", "any_", "(_", "is", "\\u", "sko", "lem", "_", "(_", "r_", ")_", "for_", "r_", ",_", "n_", "in_", "relation", "s", "\\u", "clause_", "(_", "cl_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", " ", " ", " ", "print", " ", "\"", "pre", "\\u", "case", "2", ":", " ", "{}", "\".", "format", "(", "pre", "\\u", "case", ")_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "interp", "ola", "nt_", "(_", "pre", "\\u", "state_", ",_", "pre", "\\u", "case_", ",_", "axiom", "s_", ",_", "interprete", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "interp", "ola", "nt", "\\u", "case_", "(_", "pre", "\\u", "state_", ",_", "post_", ",_", "axiom", "s_", ",_", "interprete", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", "interp", "ola", "nt", "\\u", "case", ":", " ", "bef", "ore", " ", "clause", "s", "\\u", "case", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", "interp", "ola", "nt", "\\u", "case", " ", "post", ":", " ", "{}", "\".", "format", "(", "post", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "post", "\\u", "case_", "=_", "clause", "s", "\\u", "case_", "(_", "post_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", "interp", "ola", "nt", "\\u", "case", ":", " ", "after", " ", "clause", "s", "\\u", "case", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", "print", " ", "\"", "post", "\\u", "case", "1", ":", " ", "{}", "\".", "format", "(", "post", "\\u", "case", ")_", "\\u\\u\\uNL\\u\\u\\u_", "post", "\\u", "case_", "=_", "Cla", "uses_", "(_", "[_", "cl_", "for_", "cl_", "in_", "post", "\\u", "case_", "._", "clauses_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "cl_", ")_", "<=_", "1_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "is", "\\u", "ground", "\\u", "clause_", "(_", "cl_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "not_", "any_", "(_", "is", "\\u", "sko", "lem", "_", "(_", "r_", ")_", "for_", "r_", ",_", "n_", "in_", "relation", "s", "\\u", "clause_", "(_", "cl_", ")_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", "interp", "ola", "nt", "\\u", "case", ":", " ", "after", " ", "filtering", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", "post", "\\u", "case", "2", ":", " ", "{}", "\".", "format", "(", "post", "\\u", "case", ")_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "interp", "ola", "nt_", "(_", "pre", "\\u", "state_", ",_", "post", "\\u", "case_", ",_", "axiom", "s_", ",_", "interprete", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "interp", "\\u", "from", "\\u", "unsa", "t", "\\u", "core_", "(_", "clause", "s1_", ",_", "clause", "s2_", ",_", "core_", ",_", "interprete", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "used", "\\u", "syms_", "=_", "used", "\\u", "symbols", "\\u", "clauses_", "(_", "core_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vars_", "=_", "used", "\\u", "variab", "les", "\\u", "clauses_", "(_", "core_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "vars_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", "interp", "ola", "nt", " ", "wou", "ld", " ", "require", " ", "sko", "lem", " ", "constant", "s", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "core", "\\u", "consts_", "=_", "used", "\\u", "constant", "s", "\\u", "clauses_", "(_", "core_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clause", "s2", "\\u", "consts_", "=_", "used", "\\u", "constant", "s", "\\u", "clauses_", "(_", "clause", "s2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", "interp", "\\u", "from", "\\u", "unsa", "t", "\\u", "core", " ", "core", "\\u", "const", "s", " ", "=", " ", "{}", "\".", "format", "(", "map", "(", "str", ",", "core", "\\u", "const", "s", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", "interp", "\\u", "from", "\\u", "unsa", "t", "\\u", "core", " ", "clause", "s2", "\\u", "const", "s", " ", "=", " ", "{}", "\".", "format", "(", "map", "(", "str", ",", "clause", "s2", "\\u", "const", "s", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "rena", "ming", "_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "v_", "in_", "core", "\\u", "consts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "v_", "not_", "in_", "clause", "s2", "\\u", "consts_", "or_", "v_", "._", "is", "\\u", "sko", "lem", "_", "(_", ")_", ":_", "#", " ", "and", " ", "v", " ", "not", " ", "in", " ", "interprete", "d", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rena", "ming", "_", "[_", "v_", "]_", "=_", "Variable_", "(_", "'", "V", "'_", "+_", "str_", "(_", "i_", ")_", ",_", "Constant_", "(_", "v_", ")_", "._", "get", "\\u", "sort_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", "interp", "\\u", "from", "\\u", "unsa", "t", "\\u", "core", " ", "core", " ", "=", " ", "{}", "\".", "format", "(", "core", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", "interp", "\\u", "from", "\\u", "unsa", "t", "\\u", "core", " ", "rena", "ming", " ", "=", " ", "{}", "\".", "format", "(", "rena", "ming", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "renamed", "\\u", "core_", "=_", "substitute", "\\u", "constant", "s", "\\u", "clauses_", "(_", "core_", ",_", "rena", "ming", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", "interp", "\\u", "from", "\\u", "unsa", "t", "\\u", "core", " ", "renamed", "\\u", "core", " ", "=", " ", "{}", "\".", "format", "(", "renamed", "\\u", "core", ")_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "simplify", "\\u", "clauses_", "(_", "Cla", "uses_", "(_", "[_", "Or_", "(_", "*_", "[_", "negate", "_", "(_", "c_", ")_", "for_", "c_", "in_", "renamed", "\\u", "core_", "._", "fm", "las", "_", "]_", ")_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", "interp", "\\u", "from", "\\u", "unsa", "t", "\\u", "core", " ", "res", " ", "=", " ", "{}", "\".", "format", "(", "res", ")_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "small", "\\u", "model", "\\u", "clauses_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Don", "'", "t", " ", "try", " ", "to", " ", "shrink", " ", "the", " ", "integ", "ers", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "get", "\\u", "small", "\\u", "model_", "(_", "cls_", ",_", "iv", "y", "\\u", "logic_", "._", "unin", "terp", "ret", "ed", "\\u", "sorts", "_", "(_", ")_", ",_", "[_", "]_", ")_", "\\u\\u\\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_", "History_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "A", " ", "histo", "ry", " ", "is", " ", "a", " ", "symbolic", "ally", " ", "represent", "ed", " ", "sequence", " ", "of", " ", "state", "s", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "History_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "state_", ",_", "maps_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "state", " ", "is", " ", "the", " ", "initial", " ", "state", " ", "of", " ", "the", " ", "histo", "ry", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", "init", ":", " ", "{}", "\".", "format", "(", "state", ")_", "\\u\\u\\uNL\\u\\u\\u_", "update_", ",_", "clauses_", ",_", "pre_", "=_", "state_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "update_", "==_", "None_", "and_", "pre_", "._", "is", "\\u", "false_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "maps_", "=_", "maps_", "#", " ", "sequence", " ", "of", " ", "symbol", " ", "rena", "ming", "s", " ", "result", "ing", " ", "from", " ", "forward", " ", "images_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "post_", "=_", "clauses_", "#", " ", "characteristic", " ", "formula", " ", "of", " ", "the", " ", "history_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "History_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "forward", "\\u", "step_", "(_", "self_", ",_", "axiom", "s_", ",_", "update_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Thi", "s", " ", "is", " ", "like", " ", "forward", "\\u", "image", " ", "on", " ", "state", "s", ",", " ", "but", " ", "record", "s", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "symbol", " ", "rena", "ming", " ", "used", " ", "in", " ", "the", " ", "forward", " ", "image", ".", " ", "The", " ", "list", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "rena", "ming", "s", " ", "is", " ", "used", " ", "to", " ", "reconstruct", " ", "the", " ", "state", " ", "symbols", " ", "at", " ", "previ", "ous", "\\", "10", ";", " ", " ", " ", " ", "times", " ", "in", " ", "the", " ", "histo", "ry", ".", " ", "A", " ", "new", " ", "histo", "ry", " ", "after", " ", "forward", " ", "step", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "return", "ed", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", "step", ":", " ", "pre", " ", "=", " ", "{}", ",", " ", "axiom", "s", " ", "=", " ", "{}", ",", " ", "update", " ", "=", " ", "{}", "\".", "format", "(", "self", ".", "post", ",", "axiom", "s", ",", "update", ")_", "\\u\\u\\uNL\\u\\u\\u_", "map", "1_", ",_", "res_", "=_", "forward", "\\u", "image", "\\u", "map_", "(_", "self_", "._", "post_", ",_", "axiom", "s_", ",_", "update_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "History_", "(_", "pure", "\\u", "state_", "(_", "res_", ")_", ",_", "self_", "._", "maps_", "+_", "[_", "map", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "History_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "assume", "_", "(_", "self_", ",_", "clauses_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Return", "s", " ", "a", " ", "new", " ", "histo", "ry", " ", "in", " ", "whi", "ch", " ", "the", " ", "final", " ", "state", " ", "is", " ", "constraint", "ed", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "satisfy", " ", "\"", "clause", "s", "\".", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", "assume", " ", "post", ":", " ", "{}", "\".", "format", "(", "self", ".", "post", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", "assume", ":", " ", "{}", "\".", "format", "(", "clause", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "clauses_", ",_", "tuple_", ")_", ":_", "#", " ", "a", " ", "pure", " ", "state_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "is", "\\u", "pure", "\\u", "state_", "(_", "clauses_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clauses_", "=_", "clauses_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "clauses_", "=_", "rename", "\\u", "distinct_", "(_", "clauses_", ",_", "self_", "._", "post_", ")_", "#", " ", "TOD", "O", ":", " ", "shou", "ld", "n", "'", "t", " ", "be", " ", "needed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "History_", "(_", "pure", "\\u", "state_", "(_", "and", "\\u", "clauses_", "(_", "self_", "._", "post_", ",_", "clauses_", ")_", ")_", ",_", "self_", "._", "maps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "History_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ignore_", "(_", "self_", ",_", "s_", ",_", "img_", ",_", "rena", "ming", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "not_", "(_", "s_", "in_", "img_", "or_", "not_", "s_", "._", "is", "\\u", "sko", "lem", "_", "(_", ")_", "and_", "s_", "not_", "in_", "rena", "ming", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", "ignore", ":", " ", "{}", " ", "=", " ", "{}", "\".", "format", "(", "s", ",", "res", ")_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "History_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "satisfy", "_", "(_", "self_", ",_", "axiom", "s_", ",_", "\\u", "get", "\\u", "model", "\\u", "clauses_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Produce", " ", "a", " ", "state", " ", "sequence", " ", "if", " ", "the", " ", "symbolic", " ", "histo", "ry", " ", "contain", "s", "\\", "10", ";", " ", " ", " ", " ", "one", ".", " ", "Return", "s", " ", "the", " ", "sort", " ", "univ", "erse", "s", " ", "and", " ", "a", " ", "sequence", " ", "of", " ", "state", "s", ",", " ", "or", "\\", "10", ";", " ", " ", " ", " ", "Non", "e", " ", "if", " ", "the", " ", "histo", "ry", " ", "is", " ", "vac", "uo", "us", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u", "get", "\\u", "model", "\\u", "clauses_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "get", "\\u", "model", "\\u", "clauses_", "=_", "small", "\\u", "model", "\\u", "clauses_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", "axiom", "s", ":", " ", "{}", "\".", "format", "(", "axiom", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "model", " ", "of", " ", "the", " ", "post", "-", "state", " ", "embeds", " ", "a", " ", "valuation", " ", "for", " ", "each", " ", "time_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "the", " ", "histo", "ry", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "post_", "=_", "and", "\\u", "clauses_", "(_", "self_", "._", "post_", ",_", "axiom", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", "post", ":", " ", "{}", "\".", "format", "(", "post", ")_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"", "bounded", " ", "check", " ", "{\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "=_", "\\u", "get", "\\u", "model", "\\u", "clauses_", "(_", "post_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"}", " ", "bounded", " ", "check", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "model_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", "core", " ", "=", " ", "{}", "\".", "format", "(", "unsa", "t", "\\u", "core", "(", "post", ",", "true", "\\u", "clause", "s", "())", ")_", "\\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_", "#", " ", "we", " ", "reconstruct", " ", "the", " ", "sub", "-", "model", " ", "for", " ", "each", " ", "state", " ", "composi", "ng", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "recorde", "d", " ", "rena", "ming", "s", " ", "in", " ", "reverse", " ", "order", ".", " ", "Her", "e", " ", "\"", "rena", "ming", "\"", " ", "maps_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "symbols", " ", "represent", "ing", " ", "a", " ", "past", " ", "time", " ", "onto", " ", "current", " ", "time", " ", "sko", "lem", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rena", "ming", "_", ",_", "states_", ",_", "maps_", "=_", "{_", "}_", ",_", "[_", "]_", ",_", "reversed_", "(_", "self_", "._", "maps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "ignore", " ", "all", " ", "symbols", " ", "except", " ", "tho", "se", " ", "represent", "ing", " ", "the", " ", "give", "n", " ", "past", " ", "time_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "img_", "=_", "set_", "(_", "rena", "ming", "_", "[_", "s_", "]_", "for_", "s_", "in_", "rena", "ming", "_", "if_", "not_", "s_", "._", "is", "\\u", "sko", "lem", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ignore_", "=_", "lambda_", "s_", ":_", "self_", "._", "ignore_", "(_", "s_", ",_", "img_", ",_", "rena", "ming", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "the", " ", "sub", "-", "mode", " ", "for", " ", "the", " ", "give", "n", " ", "past", " ", "time", " ", "as", " ", "a", " ", "formula_", "\\u\\u\\uNL\\u\\u\\u_", "clauses_", "=_", "clause", "s", "\\u", "model", "\\u", "to", "\\u", "clauses_", "(_", "post_", ",_", "ignore_", "=_", "ignore_", ",_", "model_", "=_", "model_", ",_", "numeral", "s_", "=_", "use", "\\u", "numeral", "s_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "map", " ", "this", " ", "formula", " ", "int", "o", " ", "the", " ", "past", " ", "usi", "ng", " ", "inv", "erse", " ", "map_", "\\u\\u\\uNL\\u\\u\\u_", "clauses_", "=_", "rename", "\\u", "clauses_", "(_", "clauses_", ",_", "inv", "erse", "\\u", "map_", "(_", "rena", "ming", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "remove", " ", "tau", "tol", "og", "y", " ", "equal", "iti", "es", ",", " ", "TOD", "O", ":", " ", "not", " ", "sure", " ", "if", " ", "this", " ", "is", " ", "correct", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "clauses_", "=_", "Cla", "uses_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "f_", "for_", "f_", "in_", "clauses_", "._", "fm", "las", "_", "if_", "not_", "is", "\\u", "tau", "tol", "og", "y", "\\u", "equality", "_", "(_", "f_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "clauses_", "._", "defs_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "states_", "._", "append_", "(_", "clauses_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "update", " ", "the", " ", "inv", "erse", " ", "map", " ", "by", " ", "composi", "ng", " ", "it", " ", "with", " ", "inverse_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "the", " ", "next", " ", "rena", "ming", " ", "(", "in", " ", "reverse", " ", "order", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rena", "ming", "_", "=_", "compose", "\\u", "maps_", "(_", "next_", "(_", "maps_", ")_", ",_", "rena", "ming", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Sto", "p", "Iteration_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "uv", "s_", "=_", "model_", "._", "univ", "erse", "s_", "(_", "numeral", "s_", "=_", "use", "\\u", "numeral", "s_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", "uv", "s", ":", " ", "{}", "\".", "format", "(", "uv", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "uv", "s_", ",_", "[_", "pure", "\\u", "state_", "(_", "clauses_", ")_", "for_", "clauses_", "in_", "reversed_", "(_", "states_", ")_", "]_", "\\u\\u\\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_", "use", "\\u", "numeral", "s_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "iu", "_", "._", "use", "\\u", "numeral", "s_", "._", "get_", "(_", ")_" ]
[ 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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-8 -*-\n\nimport sys\nimport os\nimport time\nimport stat\nimport datetime\n\nfrom gluon.utils import md5_hash\nfrom gluon.restricted import RestrictedError\nfrom gluon.tools import Mail\n\n\npath = os.path.join(request.folder, 'errors')\nhashes = {}\nmail = Mail()\n\n### CONFIGURE HERE\nSLEEP_MINUTES = 5\nALLOW_DUPLICATES = True\nmail.settings.server = 'localhost:25'\nmail.settings.sender = 'you@localhost'\nadministrator_email = 'you@localhost'\n### END CONFIGURATION\n\nwhile 1:\n for file in os.listdir(path):\n if not ALLOW_DUPLICATES:\n fileobj = open(file, 'r')\n try:\n file_data = fileobj.read()\n finally:\n fileobj.close()\n key = md5_hash(file_data)\n\n if key in hashes:\n continue\n\n hashes[key] = 1\n\n error = RestrictedError()\n error.load(request, request.application, file)\n\n mail.send(to=administrator_email,\n subject='new web2py ticket', message=error.traceback)\n\n os.unlink(os.path.join(path, file))\n time.sleep(SLEEP_MINUTES * 60)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import sys", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 10 }, { "span": "import stat", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 11 }, { "span": "import datetime", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 15 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "stat_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "gluon_", "._", "utils_", "import_", "md5", "\\u", "hash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gluon_", "._", "restricted_", "import_", "Restrict", "ed", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gluon_", "._", "tools_", "import_", "Mail_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "request_", "._", "folder_", ",_", "'", "error", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hashes_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mail_", "=_", "Mail_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", "CONFIG", "URE", " ", "HER", "E_", "\\u\\u\\uNL\\u\\u\\u_", "SLEEP", "\\u", "MINUTE", "S_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ALLOW", "\\u", "DUPL", "ICAT", "ES_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mail_", "._", "settings_", "._", "server_", "=_", "'", "local", "host", ":", "25", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mail_", "._", "settings_", "._", "sender_", "=_", "'", "you", "@", "local", "host", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "administrat", "or", "\\u", "email_", "=_", "'", "you", "@", "local", "host", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###", " ", "END", " ", "CONFIGURATION", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "file_", "in_", "os_", "._", "listdir_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "ALLOW", "\\u", "DUPL", "ICAT", "ES_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fileobj_", "=_", "open_", "(_", "file_", ",_", "'", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file", "\\u", "data_", "=_", "fileobj_", "._", "read_", "(_", ")_", "\\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 ", " _", "fileobj_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "key_", "=_", "md5", "\\u", "hash_", "(_", "file", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "key_", "in_", "hashes_", ":_", "\\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_", "hashes_", "[_", "key_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "error_", "=_", "Restrict", "ed", "Error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error_", "._", "load_", "(_", "request_", ",_", "request_", "._", "application_", ",_", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mail_", "._", "send_", "(_", "to_", "=_", "administrat", "or", "\\u", "email_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "subject_", "=_", "'", "new", " ", "web", "2py", " ", "tick", "et", "'_", ",_", "message_", "=_", "error_", "._", "traceback_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "unlink_", "(_", "os_", "._", "path_", "._", "join_", "(_", "path_", ",_", "file_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "SLEEP", "\\u", "MINUTE", "S_", "*_", "60_", ")_", "\\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, 0, 1, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
mozilla/inventory/api_v2/reverse_dns_handler.py
[ { "content": "from piston.handler import BaseHandler, rc\nfrom systems.models import System, SystemRack,SystemStatus,NetworkAdapter,KeyValue,ScheduledTask\nfrom truth.models import Truth, KeyValue as TruthKeyValue\nfrom MacroExpansion import MacroExpansion\nfrom KeyValueTree import KeyValueTree\nimport re\ntry:\n import json\nexcept:\n from django.utils import simplejson as json\nfrom django.test.client import Client\nfrom settings import API_ACCESS\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ReverseDNSHandler(BaseHandler):\n allowed_methods = API_ACCESS\n model = System\n #fields = ('id', 'asset_tag', 'oob_ip', 'hostname', 'operating_system', ('system_status',('status', 'id')))\n exclude = ()", "metadata": "root.ReverseDNSHandler", "header": "['module', '___EOS___']", "index": 12 }, { "content": " def read(self, request, reverse_dns_zone=None, reverse_dns_action=None):\n if reverse_dns_zone and reverse_dns_action == 'get_reverse_dns_zones':\n tasks = []\n for task in ScheduledTask.objects.get_all_reverse_dns():\n tasks.append(task.task)\n #ScheduledTask.objects.delete_all_reverse_dns()\n return tasks\n elif reverse_dns_zone and reverse_dns_action == 'get_reverse_dns_zones_with_names':\n truths = Truth.objects.select_related().filter(keyvalue__key='is_reverse_dns_zone',keyvalue__value='True')\n truth_list = []\n for t in truths:\n truth_list.append({'name':t.name.strip(),'description':t.description.strip()})\n return truth_list\n elif reverse_dns_zone and reverse_dns_action == 'view_hosts':\n scope_options = []\n client = Client()\n hosts = json.loads(client.get('/api/keyvalue/?key_type=system_by_zone&zone=%s' % reverse_dns_zone, follow=True).content)\n #print hosts\n adapter_list = []\n for host in hosts:\n if 'hostname' in host:\n the_url = '/api/keyvalue/?key_type=adapters_by_system_and_zone&reverse_dns_zone=%s&system=%s' % (reverse_dns_zone, host['hostname'])\n try:\n adapter_list.append(json.loads(client.get(the_url, follow=True).content))\n except:\n pass\n #d = DHCPInterface(scope_options, adapter_list)\n #return d.get_hosts()\n return None\n else:\n resp = rc.NOT_FOUND\n resp.write(\"I'm sorry but I don't understand your request\")", "metadata": "root.ReverseDNSHandler.read", "header": "['class', 'ReverseDNSHandler', '(', 'BaseHandler', ')', ':', '___EOS___']", "index": 17 } ]
[ { "span": "from systems.models import System, SystemRack,SystemStatus,NetworkAdapter,KeyValue,ScheduledTask", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 96 }, { "span": "from truth.models import Truth, KeyValue as TruthKeyValue", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 57 }, { "span": "from MacroExpansion import MacroExpansion", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 41 }, { "span": "from KeyValueTree import KeyValueTree", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 37 }, { "span": "import re", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 9 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "pis", "ton_", "._", "handler_", "import_", "Base", "Handler_", ",_", "rc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "systems_", "._", "models_", "import_", "System_", ",_", "System", "Rack", "_", ",_", "System", "Status_", ",_", "Network", "Adapter_", ",_", "Key", "Value_", ",_", "Schedule", "d", "Task_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "truth_", "._", "models_", "import_", "Tru", "th_", ",_", "Key", "Value_", "as_", "Tru", "th", "Key", "Value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Macro", "Expa", "nsion", "_", "import_", "Macro", "Expa", "nsion", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Key", "Value", "Tree_", "import_", "Key", "Value", "Tree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "django_", "._", "utils_", "import_", "simplejson_", "as_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "django_", "._", "test_", "._", "client_", "import_", "Client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "settings_", "import_", "API", "\\u", "ACCESS", "_", "\\u\\u\\uNEWLINE\\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\\uNEWLINE\\u\\u\\u_", "class_", "Revers", "e", "DNS", "Handler_", "(_", "Base", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "allow", "ed", "\\u", "methods_", "=_", "API", "\\u", "ACCESS", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "=_", "System_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "fields", " ", "=", " ", "('", "id", "',", " ", "'", "asset", "\\u", "tag", "',", " ", "'", "oob", "\\u", "ip", "',", " ", "'", "host", "name", "',", " ", "'", "operati", "ng", "\\u", "system", "',", " ", "('", "system", "\\u", "status", "',", "('", "status", "',", " ", "'", "id", "'))", ")_", "\\u\\u\\uNL\\u\\u\\u_", "exclude_", "=_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Revers", "e", "DNS", "Handler_", "(_", "Base", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "read_", "(_", "self_", ",_", "request_", ",_", "reverse", "\\u", "dns", "\\u", "zone_", "=_", "None_", ",_", "reverse", "\\u", "dns", "\\u", "action_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "reverse", "\\u", "dns", "\\u", "zone_", "and_", "reverse", "\\u", "dns", "\\u", "action_", "==_", "'", "get", "\\u", "reverse", "\\u", "dns", "\\u", "zone", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tasks_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "task_", "in_", "Schedule", "d", "Task_", "._", "objects_", "._", "get", "\\u", "all", "\\u", "reverse", "\\u", "dns_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tasks_", "._", "append_", "(_", "task_", "._", "task_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Schedule", "d", "Task", ".", "object", "s", ".", "delete", "\\u", "all", "\\u", "reverse", "\\u", "dns", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "tasks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "reverse", "\\u", "dns", "\\u", "zone_", "and_", "reverse", "\\u", "dns", "\\u", "action_", "==_", "'", "get", "\\u", "reverse", "\\u", "dns", "\\u", "zone", "s", "\\u", "with", "\\u", "names", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "truth", "s_", "=_", "Tru", "th_", "._", "objects_", "._", "select", "\\u", "related_", "(_", ")_", "._", "filter_", "(_", "keyval", "ue", "\\u\\u", "key_", "=_", "'", "is", "\\u", "reverse", "\\u", "dns", "\\u", "zone", "'_", ",_", "keyval", "ue", "\\u\\u", "value_", "=_", "'", "Tru", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "truth", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "t_", "in_", "truth", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "truth", "\\u", "list_", "._", "append_", "(_", "{_", "'", "name", "'_", ":_", "t_", "._", "name_", "._", "strip_", "(_", ")_", ",_", "'", "description", "'_", ":_", "t_", "._", "description_", "._", "strip_", "(_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "truth", "\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "reverse", "\\u", "dns", "\\u", "zone_", "and_", "reverse", "\\u", "dns", "\\u", "action_", "==_", "'", "view", "\\u", "host", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scope", "\\u", "options_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "Client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hosts_", "=_", "json_", "._", "loads_", "(_", "client_", "._", "get_", "(_", "'/", "api", "/", "keyval", "ue", "/?", "key", "\\u", "type", "=", "system", "\\u", "by", "\\u", "zone", "&", "zone", "=", "%", "s", "'_", "%_", "reverse", "\\u", "dns", "\\u", "zone_", ",_", "follow_", "=_", "True_", ")_", "._", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "hosts_", "\\u\\u\\uNL\\u\\u\\u_", "adapter", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "host_", "in_", "hosts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "host", "name", "'_", "in_", "host_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "the", "\\u", "url_", "=_", "'/", "api", "/", "keyval", "ue", "/?", "key", "\\u", "type", "=", "adapter", "s", "\\u", "by", "\\u", "system", "\\u", "and", "\\u", "zone", "&", "reverse", "\\u", "dns", "\\u", "zone", "=", "%", "s", "&", "system", "=", "%", "s", "'_", "%_", "(_", "reverse", "\\u", "dns", "\\u", "zone_", ",_", "host_", "[_", "'", "host", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "adapter", "\\u", "list_", "._", "append_", "(_", "json_", "._", "loads_", "(_", "client_", "._", "get_", "(_", "the", "\\u", "url_", ",_", "follow_", "=_", "True_", ")_", "._", "content_", ")_", ")_", "\\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_", "#", "d", " ", "=", " ", "DHC", "PI", "nter", "face", "(", "scope", "\\u", "options", ",", " ", "adapter", "\\u", "list", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "return", " ", "d", ".", "get", "\\u", "host", "s", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "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 ", " _", "resp_", "=_", "rc_", "._", "NOT", "\\u", "FOUND_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "._", "write_", "(_", "\"", "I", "'", "m", " ", "sorr", "y", " ", "but", " ", "I", " ", "don", "'", "t", " ", "underst", "and", " ", "your", " ", "request", "\"_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
ImageEngine/gaffer/python/GafferArnoldUI/ArnoldRenderUI.py
[ { "content": "##########################################################################\n#\n# Copyright (c) 2012-2014, John Haddon. 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 IECore\n\nimport Gaffer\nimport GafferUI\nimport GafferArnold\n\nGaffer.Metadata.registerNode(\n\n\tGafferArnold.ArnoldRender,\n\n\t\"description\",\n\t\"\"\"\n\tPerforms offline batch rendering using the\n\tArnold renderer. This is done in two phases -\n\tfirst a .ass file is generated and then Arnold\n\tis invoked to render it. Note though that the .ass\n\tfile is lightweight, and contains little more than\n\ta procedural which will use Gaffer to generate the\n\tscene at render time.\n\t\"\"\",\n\n\tplugs = {\n\n\t\t\"mode\" : [\n\n\t\t\t\"description\",\n\t\t\t\"\"\"\n\t\t\tWhen in the standard \"Render\" mode, an .ass\n\t\t\tfile is generated and then renderered in Arnold.\n\t\t\tAlternatively, just the .ass file can be generated\n\t\t\tand then another method can be used to post-process\n\t\t\tit or launch the render - a SystemCommand node may\n\t\t\tbe useful for this. Finally, an expanded .ass file\n\t\t\tmay be generated - this will contain the entire\n\t\t\texpanded scene rather than just a procedural, and can\n\t\t\tbe useful for debugging.\n\t\t\t\"\"\",\n\n\t\t\t\"preset:Render\", \"render\",\n\t\t\t\"preset:Generate .ass only\", \"generate\",\n\t\t\t\"preset:Generate expanded .ass\", \"expand\",\n\n\t\t\t\"nodule:type\", \"\",\n\t\t\t\"plugValueWidget:type\", \"GafferUI.PresetsPlugValueWidget\",\n\n\t\t],\n\n\t\t\"fileName\" : [\n\n\t\t\t\"description\",\n\t\t\t\"\"\"\n\t\t\tThe name of the .ass file to be generated.\n\t\t\t\"\"\",\n\n\t\t\t\"nodule:type\", \"\",\n\t\t\t\"plugValueWidget:type\", \"GafferUI.FileSystemPathPlugValueWidget\",\n\t\t\t\"pathPlugValueWidget:bookmarks\", \"ass\",\n\t\t\t\"pathPlugValueWidget:leaf\", True,\n\t\t\t\"fileSystemPathPlugValueWidget:extensions\", IECore.StringVectorData( [ \"ass\" ] ),\n\n\t\t],\n\n\t\t\"verbosity\" : [\n\n\t\t\t\"description\",\n\t\t\t\"\"\"\n\t\t\tControls the verbosity of the Arnold renderer output.\n\t\t\t\"\"\",\n\n\t\t\t\"preset:0\", 0,\n\t\t\t\"preset:1\", 1,\n\t\t\t\"preset:2\", 2,\n\t\t\t\"preset:3\", 3,\n\t\t\t\"preset:4\", 4,\n\t\t\t\"preset:5\", 5,\n\t\t\t\"preset:6\", 6,\n\n\t\t\t\"nodule:type\", \"\",\n\t\t\t\"plugValueWidget:type\", \"GafferUI.PresetsPlugValueWidget\",\n\n\t\t],\n\n\t}\n\n)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import GafferUI", "start_line": 39, "start_column": 0, "end_line": 39, "end_column": 15 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "######", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Copy", "right", " ", "(", "c", ")", " ", "2012", "-", "2014", ",", " ", "Joh", "n", " ", "Had", "don", ".", " ", "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_", "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", "UI_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Ga", "ffer", "Arn", "old_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Ga", "ffer", "_", "._", "Metadata_", "._", "register", "Node_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Ga", "ffer", "Arn", "old_", "._", "Arn", "old", "Render_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "description", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "\t", "Perform", "s", " ", "offline", " ", "batch", " ", "render", "ing", " ", "usi", "ng", " ", "the", "\\", "10", ";", "\t", "Arn", "old", " ", "render", "er", ".", " ", "Thi", "s", " ", "is", " ", "don", "e", " ", "in", " ", "two", " ", "phase", "s", " ", "-", "\\", "10", ";", "\t", "first", " ", "a", " ", ".", "ass", " ", "file", " ", "is", " ", "generat", "ed", " ", "and", " ", "then", " ", "Arn", "old", "\\", "10", ";", "\t", "is", " ", "invoke", "d", " ", "to", " ", "render", " ", "it", ".", " ", "Not", "e", " ", "tho", "ugh", " ", "tha", "t", " ", "the", " ", ".", "ass", "\\", "10", ";", "\t", "file", " ", "is", " ", "light", "weight", ",", " ", "and", " ", "contain", "s", " ", "litt", "le", " ", "more", " ", "than", "\\", "10", ";", "\t", "a", " ", "proce", "dura", "l", " ", "whi", "ch", " ", "will", " ", "use", " ", "Ga", "ffer", " ", "to", " ", "generat", "e", " ", "the", "\\", "10", ";", "\t", "scen", "e", " ", "at", " ", "render", " ", "time", ".", "\\", "10", ";", "\t", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plug", "s_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mode", "\"_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "description", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "\t\t\t", "Whe", "n", " ", "in", " ", "the", " ", "standard", " ", "\"", "Render", "\"", " ", "mode", ",", " ", "an", " ", ".", "ass", "\\", "10", ";", "\t\t\t", "file", " ", "is", " ", "generat", "ed", " ", "and", " ", "then", " ", "render", "ere", "d", " ", "in", " ", "Arn", "old", ".", "\\", "10", ";", "\t\t\t", "Alternative", "ly", ",", " ", "just", " ", "the", " ", ".", "ass", " ", "file", " ", "can", " ", "be", " ", "generat", "ed", "\\", "10", ";", "\t\t\t", "and", " ", "then", " ", "anot", "her", " ", "method", " ", "can", " ", "be", " ", "used", " ", "to", " ", "post", "-", "process", "\\", "10", ";", "\t\t\t", "it", " ", "or", " ", "launch", " ", "the", " ", "render", " ", "-", " ", "a", " ", "System", "Command", " ", "node", " ", "may", "\\", "10", ";", "\t\t\t", "be", " ", "usef", "ul", " ", "for", " ", "this", ".", " ", "Final", "ly", ",", " ", "an", " ", "expand", "ed", " ", ".", "ass", " ", "file", "\\", "10", ";", "\t\t\t", "may", " ", "be", " ", "generat", "ed", " ", "-", " ", "this", " ", "will", " ", "contain", " ", "the", " ", "entire", "\\", "10", ";", "\t\t\t", "expand", "ed", " ", "scen", "e", " ", "rat", "her", " ", "than", " ", "just", " ", "a", " ", "proce", "dura", "l", ",", " ", "and", " ", "can", "\\", "10", ";", "\t\t\t", "be", " ", "usef", "ul", " ", "for", " ", "debugg", "ing", ".", "\\", "10", ";", "\t\t\t", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "prese", "t", ":", "Render", "\"_", ",_", "\"", "render", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "prese", "t", ":", "Generate", " ", ".", "ass", " ", "only", "\"_", ",_", "\"", "generat", "e", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "prese", "t", ":", "Generate", " ", "expand", "ed", " ", ".", "ass", "\"_", ",_", "\"", "expand", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "nod", "ule", ":", "type", "\"_", ",_", "\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "plug", "Value", "Wid", "get", ":", "type", "\"_", ",_", "\"", "Ga", "ffer", "UI", ".", "Preset", "s", "Plug", "Value", "Wid", "get", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "file", "Name", "\"_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "description", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "\t\t\t", "The", " ", "name", " ", "of", " ", "the", " ", ".", "ass", " ", "file", " ", "to", " ", "be", " ", "generat", "ed", ".", "\\", "10", ";", "\t\t\t", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "nod", "ule", ":", "type", "\"_", ",_", "\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "plug", "Value", "Wid", "get", ":", "type", "\"_", ",_", "\"", "Ga", "ffer", "UI", ".", "File", "System", "Path", "Plug", "Value", "Wid", "get", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "path", "Plug", "Value", "Wid", "get", ":", "bookmark", "s", "\"_", ",_", "\"", "ass", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "path", "Plug", "Value", "Wid", "get", ":", "leaf", "\"_", ",_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "file", "System", "Path", "Plug", "Value", "Wid", "get", ":", "extensi", "ons", "\"_", ",_", "IE", "Core_", "._", "String", "Vector", "Data_", "(_", "[_", "\"", "ass", "\"_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "verbo", "sity", "\"_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "description", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "\t\t\t", "Control", "s", " ", "the", " ", "verbo", "sity", " ", "of", " ", "the", " ", "Arn", "old", " ", "render", "er", " ", "output", ".", "\\", "10", ";", "\t\t\t", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "prese", "t", ":", "0", "\"_", ",_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "prese", "t", ":", "1", "\"_", ",_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "prese", "t", ":", "2", "\"_", ",_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "prese", "t", ":", "3", "\"_", ",_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "prese", "t", ":", "4", "\"_", ",_", "4_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "prese", "t", ":", "5", "\"_", ",_", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "prese", "t", ":", "6", "\"_", ",_", "6_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "nod", "ule", ":", "type", "\"_", ",_", "\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "plug", "Value", "Wid", "get", ":", "type", "\"_", ",_", "\"", "Ga", "ffer", "UI", ".", "Preset", "s", "Plug", "Value", "Wid", "get", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", ")_" ]
[ 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, 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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
zeaphoo/cocopot/tests/test_compat.py
[ { "content": "def test_compat():\n assert to_bytes(None) == None\n assert to_unicode(None) == None\n with pytest.raises(ZeroDivisionError):\n try:\n s = 1/0\n except:\n exc_type, exc_value, tb = sys.exc_info()\n reraise(exc_type, exc_value, tb)\n\n with pytest.raises(ZeroDivisionError):\n try:\n s = 1/0\n except:\n exc_type, exc_value, tb = sys.exc_info()\n reraise(exc_type, exc_value, None)", "metadata": "root.test_compat", "header": "['module', '___EOS___']", "index": 7 } ]
[ { "span": "s ", "start_line": 12, "start_column": 12, "end_line": 12, "end_column": 13 } ]
[]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "compat_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "to", "\\u", "bytes_", "(_", "None_", ")_", "==_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "to", "\\u", "unicode_", "(_", "None_", ")_", "==_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "Zero", "Divis", "ion", "Error_", ")_", ":_", "\\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 ", " _", "s_", "=_", "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 ", " _", "exc", "\\u", "type_", ",_", "exc", "\\u", "value_", ",_", "tb_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reraise", "_", "(_", "exc", "\\u", "type_", ",_", "exc", "\\u", "value_", ",_", "tb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "Zero", "Divis", "ion", "Error_", ")_", ":_", "\\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 ", " _", "s_", "=_", "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 ", " _", "exc", "\\u", "type_", ",_", "exc", "\\u", "value_", ",_", "tb_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reraise", "_", "(_", "exc", "\\u", "type_", ",_", "exc", "\\u", "value_", ",_", "None_", ")_" ]
[ 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
vivekn/sentiment/info.py
[ { "content": "from __future__ import division\nfrom math import log, exp\nfrom operator import mul\nfrom collections import Counter\nimport os\nimport pylab\nimport cPickle\n\n\n\npos = MyDict()\nneg = MyDict()\nfeatures = set()\ntotals = [0, 0]\ndelchars = ''.join(c for c in map(chr, range(128)) if not c.isalnum())\n\nCDATA_FILE = \"countdata.pickle\"\nFDATA_FILE = \"reduceddata.pickle\"\n\n\n\n\n\n\n\n\n\n\n\n\n\nif __name__ == '__main__':\n train()\n feature_selection_trials()\n # test_pang_lee()\n # classify_demo(open(\"pos_example\").read())\n # classify_demo(open(\"neg_example\").read())\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class MyDict(dict):", "metadata": "root.MyDict", "header": "['module', '___EOS___']", "index": 9 }, { "content": " def __getitem__(self, key):\n if key in self:\n return self.get(key)\n return 0", "metadata": "root.MyDict.__getitem__", "header": "['class', 'MyDict', '(', 'dict', ')', ':', '___EOS___']", "index": 10 }, { "content": "def negate_sequence(text):\n \"\"\"\n Detects negations and transforms negated words into \"not_\" form.\n \"\"\"\n negation = False\n delims = \"?.,!:;\"\n result = []\n words = text.split()\n prev = None\n pprev = None\n for word in words:\n # stripped = word.strip(delchars)\n stripped = word.strip(delims).lower()\n negated = \"not_\" + stripped if negation else stripped\n result.append(negated)\n if prev:\n bigram = prev + \" \" + negated\n result.append(bigram)\n if pprev:\n trigram = pprev + \" \" + bigram\n result.append(trigram)\n pprev = prev\n prev = negated\n\n if any(neg in word for neg in [\"not\", \"n't\", \"no\"]):\n negation = not negation\n\n if any(c in word for c in delims):\n negation = False\n\n return result", "metadata": "root.negate_sequence", "header": "['module', '___EOS___']", "index": 25 }, { "content": "def train():\n global pos, neg, totals\n retrain = False\n \n # Load counts if they already exist.\n if not retrain and os.path.isfile(CDATA_FILE):\n pos, neg, totals = cPickle.load(open(CDATA_FILE))\n return\n\n limit = 12500\n for file in os.listdir(\"./aclImdb/train/pos\")[:limit]:\n for word in set(negate_sequence(open(\"./aclImdb/train/pos/\" + file).read())):\n pos[word] += 1\n neg['not_' + word] += 1\n for file in os.listdir(\"./aclImdb/train/neg\")[:limit]:\n for word in set(negate_sequence(open(\"./aclImdb/train/neg/\" + file).read())):\n neg[word] += 1\n pos['not_' + word] += 1\n \n prune_features()\n\n totals[0] = sum(pos.values())\n totals[1] = sum(neg.values())\n \n countdata = (pos, neg, totals)\n cPickle.dump(countdata, open(CDATA_FILE, 'w'))", "metadata": "root.train", "header": "['module', '___EOS___']", "index": 58 }, { "content": "def classify(text):\n words = set(word for word in negate_sequence(text) if word in features)\n if (len(words) == 0): return True\n # Probability that word occurs in pos documents\n pos_prob = sum(log((pos[word] + 1) / (2 * totals[0])) for word in words)\n neg_prob = sum(log((neg[word] + 1) / (2 * totals[1])) for word in words)\n return pos_prob > neg_prob", "metadata": "root.classify", "header": "['module', '___EOS___']", "index": 85 }, { "content": "def classify2(text):\n \"\"\"\n For classification from pretrained data\n \"\"\"\n words = set(word for word in negate_sequence(text) if word in pos or word in neg)\n if (len(words) == 0): return True\n # Probability that word occurs in pos documents\n pos_prob = sum(log((pos[word] + 1) / (2 * totals[0])) for word in words)\n neg_prob = sum(log((neg[word] + 1) / (2 * totals[1])) for word in words)\n return pos_prob > neg_prob", "metadata": "root.classify2", "header": "['module', '___EOS___']", "index": 93 }, { "content": "def classify_demo(text):\n words = set(word for word in negate_sequence(text) if word in pos or word in neg)\n if (len(words) == 0): \n print \"No features to compare on\"\n return True\n\n pprob, nprob = 0, 0\n for word in words:\n pp = log((pos[word] + 1) / (2 * totals[0]))\n np = log((neg[word] + 1) / (2 * totals[1]))\n print \"%15s %.9f %.9f\" % (word, exp(pp), exp(np))\n pprob += pp\n nprob += np\n\n print (\"Positive\" if pprob > nprob else \"Negative\"), \"log-diff = %.9f\" % abs(pprob - nprob)", "metadata": "root.classify_demo", "header": "['module', '___EOS___']", "index": 104 }, { "content": "def MI(word):\n \"\"\"\n Compute the weighted mutual information of a term.\n \"\"\"\n T = totals[0] + totals[1]\n W = pos[word] + neg[word]\n I = 0\n if W==0:\n return 0\n if neg[word] > 0:\n # doesn't occur in -ve\n I += (totals[1] - neg[word]) / T * log ((totals[1] - neg[word]) * T / (T - W) / totals[1])\n # occurs in -ve\n I += neg[word] / T * log (neg[word] * T / W / totals[1])\n if pos[word] > 0:\n # doesn't occur in +ve\n I += (totals[0] - pos[word]) / T * log ((totals[0] - pos[word]) * T / (T - W) / totals[0])\n # occurs in +ve\n I += pos[word] / T * log (pos[word] * T / W / totals[0])\n return I", "metadata": "root.MI", "header": "['module', '___EOS___']", "index": 120 }, { "content": "def get_relevant_features():\n pos_dump = MyDict({k: pos[k] for k in pos if k in features})\n neg_dump = MyDict({k: neg[k] for k in neg if k in features})\n totals_dump = [sum(pos_dump.values()), sum(neg_dump.values())]\n return (pos_dump, neg_dump, totals_dump)", "metadata": "root.get_relevant_features", "header": "['module', '___EOS___']", "index": 141 }, { "content": "def prune_features():\n \"\"\"\n Remove features that appear only once.\n \"\"\"\n global pos, neg\n for k in pos.keys():\n if pos[k] <= 1 and neg[k] <= 1:\n del pos[k]\n\n for k in neg.keys():\n if neg[k] <= 1 and pos[k] <= 1:\n del neg[k]", "metadata": "root.prune_features", "header": "['module', '___EOS___']", "index": 147 }, { "content": "def feature_selection_trials():\n \"\"\"\n Select top k features. Vary k and plot data\n \"\"\"\n global pos, neg, totals, features\n retrain = True\n\n if not retrain and os.path.isfile(FDATA_FILE):\n pos, neg, totals = cPickle.load(open(FDATA_FILE))\n return\n\n words = list(set(pos.keys() + neg.keys()))\n print \"Total no of features:\", len(words)\n words.sort(key=lambda w: -MI(w))\n num_features, accuracy = [], []\n bestk = 0\n limit = 500\n path = \"./aclImdb/test/\"\n step = 500\n start = 20000\n best_accuracy = 0.0\n for w in words[:start]:\n features.add(w)\n for k in xrange(start, 40000, step):\n for w in words[k:k+step]:\n features.add(w)\n correct = 0\n size = 0\n\n for file in os.listdir(path + \"pos\")[:limit]:\n correct += classify(open(path + \"pos/\" + file).read()) == True\n size += 1\n\n for file in os.listdir(path + \"neg\")[:limit]:\n correct += classify(open(path + \"neg/\" + file).read()) == False\n size += 1\n\n num_features.append(k+step)\n accuracy.append(correct / size)\n if (correct / size) > best_accuracy:\n bestk = k\n print k+step, correct / size\n\n features = set(words[:bestk])\n cPickle.dump(get_relevant_features(), open(FDATA_FILE, 'w'))\n\n pylab.plot(num_features, accuracy)\n pylab.show()", "metadata": "root.feature_selection_trials", "header": "['module', '___EOS___']", "index": 160 }, { "content": "def test_pang_lee():\n \"\"\"\n Tests the Pang Lee dataset\n \"\"\"\n total, correct = 0, 0\n for fname in os.listdir(\"txt_sentoken/pos\"):\n correct += int(classify2(open(\"txt_sentoken/pos/\" + fname).read()) == True)\n total += 1\n for fname in os.listdir(\"txt_sentoken/neg\"):\n correct += int(classify2(open(\"txt_sentoken/neg/\" + fname).read()) == False)\n total += 1\n print \"accuracy: %f\" % (correct / total)", "metadata": "root.test_pang_lee", "header": "['module', '___EOS___']", "index": 209 } ]
[ { "span": "from operator import mul", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 24 }, { "span": "from collections import Counter", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 31 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "division_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "math_", "import_", "log_", ",_", "exp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "operator_", "import_", "mul_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "collections_", "import_", "Counter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pylab_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "c", "Pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pos_", "=_", "My", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "neg_", "=_", "My", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "features_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "totals_", "=_", "[_", "0_", ",_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del", "chars_", "=_", "''_", "._", "join_", "(_", "c_", "for_", "c_", "in_", "map_", "(_", "chr_", ",_", "range_", "(_", "128_", ")_", ")_", "if_", "not_", "c_", "._", "isal", "num_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CD", "ATA", "\\u", "FILE_", "=_", "\"", "count", "data", ".", "pickle", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FD", "ATA", "\\u", "FILE_", "=_", "\"", "reduce", "dda", "ta", ".", "pickle", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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 ", " _", "train_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "feature", "\\u", "selection", "\\u", "trials_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "test\\u", "pan", "g", "\\u", "lee", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "classify", "\\u", "demo", "(", "open", "(\"", "pos", "\\u", "example", "\")", ".", "read", "())", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "classify", "\\u", "demo", "(", "open", "(\"", "neg", "\\u", "example", "\")", ".", "read", "())", "_", "\\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_", "My", "Dict_", "(_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "My", "Dict_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "getitem\\u\\u_", "(_", "self_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "key_", "in_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "get_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\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_", "def_", "negate", "\\u", "sequence_", "(_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Detect", "s", " ", "negati", "ons", " ", "and", " ", "transform", "s", " ", "negate", "d", " ", "words", " ", "int", "o", " ", "\"", "not", "\\u\"", " ", "form", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "negati", "on_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delim", "s_", "=_", "\"?", ".,", "!", ":", ";\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "text_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prev_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ppr", "ev_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "word_", "in_", "words_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "strip", "ped", " ", "=", " ", "word", ".", "strip", "(", "del", "char", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stripped_", "=_", "word_", "._", "strip_", "(_", "delim", "s_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "negate", "d_", "=_", "\"", "not", "\\u\"_", "+_", "stripped_", "if_", "negati", "on_", "else_", "stripped_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "append_", "(_", "negate", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "prev_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bigram", "_", "=_", "prev_", "+_", "\"", " ", "\"_", "+_", "negate", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "append_", "(_", "bigram", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ppr", "ev_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "trig", "ram_", "=_", "ppr", "ev_", "+_", "\"", " ", "\"_", "+_", "bigram", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "append_", "(_", "trig", "ram_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ppr", "ev_", "=_", "prev_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "prev_", "=_", "negate", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "any_", "(_", "neg_", "in_", "word_", "for_", "neg_", "in_", "[_", "\"", "not", "\"_", ",_", "\"", "n", "'", "t", "\"_", ",_", "\"", "no", "\"_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "negati", "on_", "=_", "not_", "negati", "on_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "any_", "(_", "c_", "in_", "word_", "for_", "c_", "in_", "delim", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "negati", "on_", "=_", "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_", "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_", "train_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "pos_", ",_", "neg_", ",_", "totals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "retra", "in_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Load", " ", "count", "s", " ", "if", " ", "the", "y", " ", "alr", "ead", "y", " ", "exist", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "retra", "in_", "and_", "os_", "._", "path_", "._", "isfile_", "(_", "CD", "ATA", "\\u", "FILE_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pos_", ",_", "neg_", ",_", "totals_", "=_", "c", "Pickle_", "._", "load_", "(_", "open_", "(_", "CD", "ATA", "\\u", "FILE_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "limit_", "=_", "1250", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "file_", "in_", "os_", "._", "listdir_", "(_", "\"./", "acl", "Im", "db", "/", "train", "/", "pos", "\"_", ")_", "[_", ":_", "limit_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "word_", "in_", "set_", "(_", "negate", "\\u", "sequence_", "(_", "open_", "(_", "\"./", "acl", "Im", "db", "/", "train", "/", "pos", "/\"_", "+_", "file_", ")_", "._", "read_", "(_", ")_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pos_", "[_", "word_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "neg_", "[_", "'", "not", "\\u'_", "+_", "word_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "file_", "in_", "os_", "._", "listdir_", "(_", "\"./", "acl", "Im", "db", "/", "train", "/", "neg", "\"_", ")_", "[_", ":_", "limit_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "word_", "in_", "set_", "(_", "negate", "\\u", "sequence_", "(_", "open_", "(_", "\"./", "acl", "Im", "db", "/", "train", "/", "neg", "/\"_", "+_", "file_", ")_", "._", "read_", "(_", ")_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "neg_", "[_", "word_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pos_", "[_", "'", "not", "\\u'_", "+_", "word_", "]_", "+=_", "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_", "prune", "\\u", "features_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "totals_", "[_", "0_", "]_", "=_", "sum_", "(_", "pos_", "._", "values_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "totals_", "[_", "1_", "]_", "=_", "sum_", "(_", "neg_", "._", "values_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "count", "data_", "=_", "(_", "pos_", ",_", "neg_", ",_", "totals_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c", "Pickle_", "._", "dump_", "(_", "count", "data_", ",_", "open_", "(_", "CD", "ATA", "\\u", "FILE_", ",_", "'", "w", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "classify_", "(_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "words_", "=_", "set_", "(_", "word_", "for_", "word_", "in_", "negate", "\\u", "sequence_", "(_", "text_", ")_", "if_", "word_", "in_", "features_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "len_", "(_", "words_", ")_", "==_", "0_", ")_", ":_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Probabili", "ty", " ", "tha", "t", " ", "word", " ", "occur", "s", " ", "in", " ", "pos", " ", "documents_", "\\u\\u\\uNL\\u\\u\\u_", "pos", "\\u", "prob_", "=_", "sum_", "(_", "log_", "(_", "(_", "pos_", "[_", "word_", "]_", "+_", "1_", ")_", "/_", "(_", "2_", "*_", "totals_", "[_", "0_", "]_", ")_", ")_", "for_", "word_", "in_", "words_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "neg", "\\u", "prob_", "=_", "sum_", "(_", "log_", "(_", "(_", "neg_", "[_", "word_", "]_", "+_", "1_", ")_", "/_", "(_", "2_", "*_", "totals_", "[_", "1_", "]_", ")_", ")_", "for_", "word_", "in_", "words_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "pos", "\\u", "prob_", ">_", "neg", "\\u", "prob_", "\\u\\u\\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_", "classify", "2_", "(_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "classificati", "on", " ", "from", " ", "pretrained", " ", "data", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "set_", "(_", "word_", "for_", "word_", "in_", "negate", "\\u", "sequence_", "(_", "text_", ")_", "if_", "word_", "in_", "pos_", "or_", "word_", "in_", "neg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "len_", "(_", "words_", ")_", "==_", "0_", ")_", ":_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Probabili", "ty", " ", "tha", "t", " ", "word", " ", "occur", "s", " ", "in", " ", "pos", " ", "documents_", "\\u\\u\\uNL\\u\\u\\u_", "pos", "\\u", "prob_", "=_", "sum_", "(_", "log_", "(_", "(_", "pos_", "[_", "word_", "]_", "+_", "1_", ")_", "/_", "(_", "2_", "*_", "totals_", "[_", "0_", "]_", ")_", ")_", "for_", "word_", "in_", "words_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "neg", "\\u", "prob_", "=_", "sum_", "(_", "log_", "(_", "(_", "neg_", "[_", "word_", "]_", "+_", "1_", ")_", "/_", "(_", "2_", "*_", "totals_", "[_", "1_", "]_", ")_", ")_", "for_", "word_", "in_", "words_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "pos", "\\u", "prob_", ">_", "neg", "\\u", "prob_", "\\u\\u\\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_", "classify", "\\u", "demo_", "(_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "words_", "=_", "set_", "(_", "word_", "for_", "word_", "in_", "negate", "\\u", "sequence_", "(_", "text_", ")_", "if_", "word_", "in_", "pos_", "or_", "word_", "in_", "neg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "len_", "(_", "words_", ")_", "==_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "No", " ", "features", " ", "to", " ", "compare", " ", "on", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ppro", "b_", ",_", "npr", "ob_", "=_", "0_", ",_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "word_", "in_", "words_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pp_", "=_", "log_", "(_", "(_", "pos_", "[_", "word_", "]_", "+_", "1_", ")_", "/_", "(_", "2_", "*_", "totals_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "np_", "=_", "log_", "(_", "(_", "neg_", "[_", "word_", "]_", "+_", "1_", ")_", "/_", "(_", "2_", "*_", "totals_", "[_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"%", "15", "s", " ", "%", ".9", "f", " ", "%", ".9", "f", "\"_", "%_", "(_", "word_", ",_", "exp_", "(_", "pp_", ")_", ",_", "exp_", "(_", "np_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ppro", "b_", "+=_", "pp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "npr", "ob_", "+=_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "\"", "Posi", "tiv", "e", "\"_", "if_", "ppro", "b_", ">_", "npr", "ob_", "else_", "\"", "Nega", "tiv", "e", "\"_", ")_", ",_", "\"", "log", "-", "diff", " ", "=", " ", "%", ".9", "f", "\"_", "%_", "abs_", "(_", "ppro", "b_", "-_", "npr", "ob_", ")_", "\\u\\u\\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_", "MI", "_", "(_", "word_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Compute", " ", "the", " ", "weight", "ed", " ", "mutual", " ", "informati", "on", " ", "of", " ", "a", " ", "term", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "T_", "=_", "totals_", "[_", "0_", "]_", "+_", "totals_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "W_", "=_", "pos_", "[_", "word_", "]_", "+_", "neg_", "[_", "word_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "I_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "W_", "==_", "0_", ":_", "\\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_", "if_", "neg_", "[_", "word_", "]_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "doe", "sn", "'", "t", " ", "occur", " ", "in", " ", "-", "ve_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "I_", "+=_", "(_", "totals_", "[_", "1_", "]_", "-_", "neg_", "[_", "word_", "]_", ")_", "/_", "T_", "*_", "log_", "(_", "(_", "totals_", "[_", "1_", "]_", "-_", "neg_", "[_", "word_", "]_", ")_", "*_", "T_", "/_", "(_", "T_", "-_", "W_", ")_", "/_", "totals_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "occur", "s", " ", "in", " ", "-", "ve_", "\\u\\u\\uNL\\u\\u\\u_", "I_", "+=_", "neg_", "[_", "word_", "]_", "/_", "T_", "*_", "log_", "(_", "neg_", "[_", "word_", "]_", "*_", "T_", "/_", "W_", "/_", "totals_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "pos_", "[_", "word_", "]_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "doe", "sn", "'", "t", " ", "occur", " ", "in", " ", "+", "ve_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "I_", "+=_", "(_", "totals_", "[_", "0_", "]_", "-_", "pos_", "[_", "word_", "]_", ")_", "/_", "T_", "*_", "log_", "(_", "(_", "totals_", "[_", "0_", "]_", "-_", "pos_", "[_", "word_", "]_", ")_", "*_", "T_", "/_", "(_", "T_", "-_", "W_", ")_", "/_", "totals_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "occur", "s", " ", "in", " ", "+", "ve_", "\\u\\u\\uNL\\u\\u\\u_", "I_", "+=_", "pos_", "[_", "word_", "]_", "/_", "T_", "*_", "log_", "(_", "pos_", "[_", "word_", "]_", "*_", "T_", "/_", "W_", "/_", "totals_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "I_", "\\u\\u\\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", "rele", "van", "t", "\\u", "features_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pos", "\\u", "dump_", "=_", "My", "Dict_", "(_", "{_", "k_", ":_", "pos_", "[_", "k_", "]_", "for_", "k_", "in_", "pos_", "if_", "k_", "in_", "features_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "neg", "\\u", "dump_", "=_", "My", "Dict_", "(_", "{_", "k_", ":_", "neg_", "[_", "k_", "]_", "for_", "k_", "in_", "neg_", "if_", "k_", "in_", "features_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "totals", "\\u", "dump_", "=_", "[_", "sum_", "(_", "pos", "\\u", "dump_", "._", "values_", "(_", ")_", ")_", ",_", "sum_", "(_", "neg", "\\u", "dump_", "._", "values_", "(_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "pos", "\\u", "dump_", ",_", "neg", "\\u", "dump_", ",_", "totals", "\\u", "dump_", ")_", "\\u\\u\\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_", "prune", "\\u", "features_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Remove", " ", "features", " ", "tha", "t", " ", "appear", " ", "only", " ", "onc", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global_", "pos_", ",_", "neg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", "in_", "pos_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "pos_", "[_", "k_", "]_", "<=_", "1_", "and_", "neg_", "[_", "k_", "]_", "<=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "pos_", "[_", "k_", "]_", "\\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_", "k_", "in_", "neg_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "neg_", "[_", "k_", "]_", "<=_", "1_", "and_", "pos_", "[_", "k_", "]_", "<=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "neg_", "[_", "k_", "]_", "\\u\\u\\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_", "feature", "\\u", "selection", "\\u", "trials_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Select", " ", "top", " ", "k", " ", "features", ".", " ", "Var", "y", " ", "k", " ", "and", " ", "plot", " ", "data", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global_", "pos_", ",_", "neg_", ",_", "totals_", ",_", "features_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "retra", "in_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "retra", "in_", "and_", "os_", "._", "path_", "._", "isfile_", "(_", "FD", "ATA", "\\u", "FILE_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pos_", ",_", "neg_", ",_", "totals_", "=_", "c", "Pickle_", "._", "load_", "(_", "open_", "(_", "FD", "ATA", "\\u", "FILE_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "words_", "=_", "list_", "(_", "set_", "(_", "pos_", "._", "keys_", "(_", ")_", "+_", "neg_", "._", "keys_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Total", " ", "no", " ", "of", " ", "features", ":\"_", ",_", "len_", "(_", "words_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "._", "sort_", "(_", "key_", "=_", "lambda_", "w_", ":_", "-_", "MI", "_", "(_", "w_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "features_", ",_", "accuracy_", "=_", "[_", "]_", ",_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "best", "k_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "limit_", "=_", "500_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "\"./", "acl", "Im", "db", "/", "test", "/\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "step_", "=_", "500_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start_", "=_", "20000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "best", "\\u", "accuracy_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "w_", "in_", "words_", "[_", ":_", "start_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "features_", "._", "add_", "(_", "w_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "k_", "in_", "xrange_", "(_", "start_", ",_", "40000", "_", ",_", "step_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "w_", "in_", "words_", "[_", "k_", ":_", "k_", "+_", "step_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "features_", "._", "add_", "(_", "w_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "correct_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "size_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "file_", "in_", "os_", "._", "listdir_", "(_", "path_", "+_", "\"", "pos", "\"_", ")_", "[_", ":_", "limit_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "correct_", "+=_", "classify_", "(_", "open_", "(_", "path_", "+_", "\"", "pos", "/\"_", "+_", "file_", ")_", "._", "read_", "(_", ")_", ")_", "==_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "size_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "file_", "in_", "os_", "._", "listdir_", "(_", "path_", "+_", "\"", "neg", "\"_", ")_", "[_", ":_", "limit_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "correct_", "+=_", "classify_", "(_", "open_", "(_", "path_", "+_", "\"", "neg", "/\"_", "+_", "file_", ")_", "._", "read_", "(_", ")_", ")_", "==_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "size_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "num", "\\u", "features_", "._", "append_", "(_", "k_", "+_", "step_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "accuracy_", "._", "append_", "(_", "correct_", "/_", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "correct_", "/_", "size_", ")_", ">_", "best", "\\u", "accuracy_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "best", "k_", "=_", "k_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "k_", "+_", "step_", ",_", "correct_", "/_", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "features_", "=_", "set_", "(_", "words_", "[_", ":_", "best", "k_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c", "Pickle_", "._", "dump_", "(_", "get", "\\u", "rele", "van", "t", "\\u", "features_", "(_", ")_", ",_", "open_", "(_", "FD", "ATA", "\\u", "FILE_", ",_", "'", "w", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pylab_", "._", "plot_", "(_", "num", "\\u", "features_", ",_", "accuracy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pylab_", "._", "show_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "pan", "g", "\\u", "lee", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", "s", " ", "the", " ", "Pan", "g", " ", "Lee", " ", "dataset", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total_", ",_", "correct_", "=_", "0_", ",_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "fname_", "in_", "os_", "._", "listdir_", "(_", "\"", "txt", "\\u", "sent", "oken", "/", "pos", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "correct_", "+=_", "int_", "(_", "classify", "2_", "(_", "open_", "(_", "\"", "txt", "\\u", "sent", "oken", "/", "pos", "/\"_", "+_", "fname_", ")_", "._", "read_", "(_", ")_", ")_", "==_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "fname_", "in_", "os_", "._", "listdir_", "(_", "\"", "txt", "\\u", "sent", "oken", "/", "neg", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "correct_", "+=_", "int_", "(_", "classify", "2_", "(_", "open_", "(_", "\"", "txt", "\\u", "sent", "oken", "/", "neg", "/\"_", "+_", "fname_", ")_", "._", "read_", "(_", ")_", ")_", "==_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"", "accu", "rac", "y", ":", " ", "%", "f", "\"_", "%_", "(_", "correct_", "/_", "total_", ")_", "\\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, 0, 1, 1, 1, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
openstack/bandit/examples/xml_lxml.py
[ { "content": "import lxml.etree\nimport lxml\nfrom lxml import etree\nfrom defusedxml.lxml import fromstring\nfrom defuxedxml import lxml as potatoe\n\nxmlString = \"<note>\\n<to>Tove</to>\\n<from>Jani</from>\\n<heading>Reminder</heading>\\n<body>Don't forget me this weekend!</body>\\n</note>\"\nroot = lxml.etree.fromstring(xmlString)\nroot = fromstring(xmlString)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from lxml import etree", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 22 }, { "span": "from defuxedxml import lxml as potatoe", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 38 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "lxml_", "._", "etree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "lxml_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "lxml_", "import_", "etree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "defu", "sed", "xml_", "._", "lxml_", "import_", "fromstring_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "defu", "xed", "xml_", "import_", "lxml_", "as_", "potato", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xml", "String_", "=_", "\"<", "note", ">\\\\", "n", "<", "to", ">", "To", "ve", "</", "to", ">\\\\", "n", "<", "from", ">", "Jan", "i", "</", "from", ">\\\\", "n", "<", "heading", ">", "Remi", "nder", "</", "heading", ">\\\\", "n", "<", "body", ">", "Don", "'", "t", " ", "forget", " ", "me", " ", "this", " ", "week", "end", "!<", "/", "body", ">\\\\", "n", "</", "note", ">\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "=_", "lxml_", "._", "etree_", "._", "fromstring_", "(_", "xml", "String_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "=_", "fromstring_", "(_", "xml", "String_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
networkdynamics/zenlib/src/zen/io/gml.py
[ { "content": "def build_graph(graph_tree, weight_fxn):\n\n\t# What kind of graph is being built?\n\tis_bipartite = bool('bipartite' in graph_tree and graph_tree['bipartite'])\n\tis_directed = bool('directed' in graph_tree and graph_tree['directed'])\n\n\tif is_bipartite:\n\t\tG = BipartiteGraph()\n\n\telif is_directed:\n\t\tG = DiGraph()\n\n\telse:\n\t\tG = Graph()\n\n\t# Build the nodes\n\tif 'node' in graph_tree:\n\n\t\t# get the list of nodes\n\t\tnodes = graph_tree['node']\n\n\t\t# ensure the node-list is a list (needed if there's only one node)\n\t\tif not isinstance(nodes, list):\n\t\t\tnodes = [ nodes ]\n\n\t\t# Build each node and add to the graph\n\t\tfor node in nodes:\t\n\n\t\t\t# Does the node have an id?\n\t\t\thas_id = True\n\t\t\thas_valid_id = True\n\t\t\tif 'id' not in node:\n\t\t\t\thas_id = False\n\t\t\t\thas_valid_id = False\n\n\t\t\t# We can only use positive integer node ids as graph idx\n\t\t\t# If that's not the case, treat it like any other attribute\n\t\t\telif not isinstance(node['id'], int) or node['id'] < 0:\n\t\t\t\thas_valid_id = False\n\n\t\t\t# Got a valid node id\n\t\t\tnode_idx = node['id']\n\n\t\t\t# For bipartite graphs determine which node set this belongs to \n\t\t\tif is_bipartite:\n\t\t\t\tis_in_U = node['isInU']\n\n\t\t\t# collect and verify all the node properties\n\t\t\tstandard_keys = set(['id', 'name', 'zenData'])\n\t\t\tnode_data = {}\n\t\t\tnode_obj = None\n\t\t\tzen_data = None\n\n\t\t\tfor key, val in node.items():\n\n\t\t\t\tif key == 'name':\n\t\t\t\t\tnode_obj = val\n\n\t\t\t\t# give preference to 'name' as source of node_obj\n\t\t\t\telif key == 'label' and node_obj is None: \t\n\t\t\t\t\tnode_obj = val\n\n\t\t\t\telif key == 'zenData':\n\t\t\t\t\tzen_data = val\n\t\t\t\t\n\t\t\t\t# node_data is dict of all other attributes\n\t\t\t\telse:\t\n\t\t\t\t\tnode_data[key] = val \t\n\n\t\t\t# _set_ to node_data else _append_\n\t\t\tif zen_data is not None:\n\t\t\t\tif len(node_data) == 0:\n\t\t\t\t\tnode_data = zen_data\n\t\t\t\telse:\n\t\t\t\t\tnode_data['zenData'] = zen_data\n\n\t\t\telif len(node_data) == 0:\n\t\t\t\tnode_data = None\n\n\t\t\t# make sure that the node object is hashable otherwise put it\n\t\t\tif not isinstance(node_obj, basestring) and node_obj is not None:\n\n\t\t\t\tif not isinstance(node_obj, Hashable):\\\n\n\t\t\t\t\tif not isinstance(node_obj, Iterable):\n\t\t\t\t\t\tnode_obj = None\n\n\t\t\t\t\telse:\n\t\t\t\t\t\tnode_obj = tuple(node_obj)\n\n\n\t\t\t# For bipartite graph, this insertion method does not guarantee \n\t\t\t# that indices will be unchanged after a read-write cycle\n\t\t\tif is_bipartite:\n\t\t\t\tG.add_node_by_class(is_in_U, node_obj, node_data)\n\n\t\t\telif has_id and has_valid_id:\n\t\t\t\tif is_directed:\n\t\t\t\t\tG.add_node_x(node_idx, G.edge_list_capacity,\n\t\t\t\t\t\tG.edge_list_capacity, node_obj,node_data)\n\n\t\t\t\telse:\n\t\t\t\t\tG.add_node_x(node_idx, G.edge_list_capacity, node_obj, \n\t\t\t\t\t\tnode_data)\n\n\t\t\telse:\n\t\t\t\tif G.is_directed:\n\t\t\t\t\tG.add_node(nobj=node_obj, data=node_data)\n\n\t\t\t\telse:\n\t\t\t\t\tG.add_node(nobj=node_obj, data=node_data)\n\n\t# add edges\n\tif 'edge' in graph_tree:\n\n\t\t# ensure edge list is a list (needed if there is only one edge)\n\t\tedges = graph_tree['edge']\n\t\tif not isinstance(edges, list):\n\t\t\tedges = [ edges ]\n\n\t\t# iterate over the edges, add each one to the graph\n\t\tfor edge in edges:\n\n\t\t\t# make sure source and target are specified\n\t\t\tsource = None\n\t\t\ttarget = None\n\t\t\tif 'source' not in edge:\n\t\t\t\traise ZenException('Edge is missing the source attribute '\\\n\t\t\t\t\t'(edge = %s)' % str(edge))\n\n\t\t\tif 'target' not in edge:\n\t\t\t\traise ZenException('Edge is missing the target attribute '\\\n\t\t\t\t\t'(edge = %s)' % str(edge))\n\n\t\t\tweight = 1\n\t\t\tedge_idx = None\n\t\t\tzen_data = None\n\t\t\tedge_data = {}\n\n\t\t\tfor key, val in edge.items():\n\n\t\t\t\tif key == 'id':\n\t\t\t\t\tedge_idx = val\n\t\t\t\t\tif type(val) != int:\n\t\t\t\t\t\traise ZenException('Edge id attribute must be a '\\\n\t\t\t\t\t\t\t'positive integer (edge = %s)' % str(edge))\n\n\t\t\t\telif key == 'source':\n\t\t\t\t\tsource = val\n\t\t\t\t\tif type(val) != int or val < 0:\n\t\t\t\t\t\traise ZenException('Edge source attribute must be a '\\\n\t\t\t\t\t\t\t'positive integer (edge = %s)' % str(edge))\n\n\t\t\t\telif key == 'target':\n\t\t\t\t\ttarget = val\n\t\t\t\t\tif type(val) != int or val < 0:\n\t\t\t\t\t\traise ZenException('Edge target attribute must be a '\\\n\t\t\t\t\t\t\t'positive integer (edge = %s)' % str(edge))\n\n\t\t\t\telif key == 'weight':\n\t\t\t\t\tweight = float(val)\n\n\t\t\t\telif key == 'zenData':\n\t\t\t\t\tzen_data = val\n\n\t\t\t\t# edge_data is dict of all other attributes\n\t\t\t\telse: \n\t\t\t\t\tedge_data[key] = val \t\n\n\t\t\t# give precedence to a weight-getting function if provided\n\t\t\tif weight_fxn != None:\n\t\t\t\tweight = weight_fxn(edge)\n\n\t\t\t# if zenData is only other attribute aside from those handled above \n\t\t\t# _set_ to edge_data else _append_\n\t\t\tif zen_data is not None:\n\t\t\t\tif len(edge_data) == 0:\n\t\t\t\t\tedge_data = zen_data\n\t\t\t\telse:\n\t\t\t\t\tedge_data['zenData'] = zen_data\n\n\t\t\telif len(edge_data) == 0:\n\t\t\t\tedge_data = None;\n\n\t\t\tif edge_idx != None:\n\t\t\t\tG.add_edge_x(edge_idx,source,target,edge_data,weight)\n\t\t\telse:\n\t\t\t\tG.add_edge_(source,target,edge_data,weight)\n\n\treturn G", "metadata": "root.build_graph", "header": "['module', '___EOS___']", "index": 313 } ]
[ { "span": "standard_keys ", "start_line": 361, "start_column": 3, "end_line": 361, "end_column": 16 } ]
[]
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_", "build", "\\u", "graph_", "(_", "graph", "\\u", "tree_", ",_", "weight", "\\u", "fx", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "What", " ", "kind", " ", "of", " ", "graph", " ", "is", " ", "bei", "ng", " ", "bui", "lt", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "is", "\\u", "bip", "arti", "te_", "=_", "bool_", "(_", "'", "bip", "arti", "te", "'_", "in_", "graph", "\\u", "tree_", "and_", "graph", "\\u", "tree_", "[_", "'", "bip", "arti", "te", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "\\u", "directed_", "=_", "bool_", "(_", "'", "direct", "ed", "'_", "in_", "graph", "\\u", "tree_", "and_", "graph", "\\u", "tree_", "[_", "'", "direct", "ed", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "is", "\\u", "bip", "arti", "te_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "G_", "=_", "Bi", "partit", "e", "Graph_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "is", "\\u", "directed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "G_", "=_", "Di", "Graph_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "G_", "=_", "Graph_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Build", " ", "the", " ", "nodes_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "node", "'_", "in_", "graph", "\\u", "tree_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "the", " ", "list", " ", "of", " ", "nodes_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "nodes_", "=_", "graph", "\\u", "tree_", "[_", "'", "node", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ensure", " ", "the", " ", "node", "-", "list", " ", "is", " ", "a", " ", "list", " ", "(", "need", "ed", " ", "if", " ", "there", "'", "s", " ", "only", " ", "one", " ", "node", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "nodes_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "nodes_", "=_", "[_", "nodes_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Build", " ", "each", " ", "node", " ", "and", " ", "add", " ", "to", " ", "the", " ", "graph_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "node_", "in_", "nodes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Do", "es", " ", "the", " ", "node", " ", "have", " ", "an", " ", "id", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "has", "\\u", "id_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "has", "\\u", "valid", "\\u", "id_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "id", "'_", "not_", "in_", "node_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "has", "\\u", "id_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "has", "\\u", "valid", "\\u", "id_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "can", " ", "only", " ", "use", " ", "posit", "ive", " ", "integ", "er", " ", "node", " ", "ids", " ", "as", " ", "graph", " ", "idx_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "tha", "t", "'", "s", " ", "not", " ", "the", " ", "case", ",", " ", "treat", " ", "it", " ", "like", " ", "any", " ", "other", " ", "attribute_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "isinstance_", "(_", "node_", "[_", "'", "id", "'_", "]_", ",_", "int_", ")_", "or_", "node_", "[_", "'", "id", "'_", "]_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "has", "\\u", "valid", "\\u", "id_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Got", " ", "a", " ", "valid", " ", "node", " ", "id_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "node", "\\u", "idx_", "=_", "node_", "[_", "'", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "bip", "arti", "te", " ", "graph", "s", " ", "dete", "rmin", "e", " ", "whi", "ch", " ", "node", " ", "set", " ", "this", " ", "belo", "ngs", " ", "to", " _", "\\u\\u\\uNL\\u\\u\\u_", "if_", "is", "\\u", "bip", "arti", "te_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "is", "\\u", "in", "\\u", "U_", "=_", "node_", "[_", "'", "is", "In", "U", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "collect", " ", "and", " ", "verify", " ", "all", " ", "the", " ", "node", " ", "properties_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "standard", "\\u", "keys_", "=_", "set_", "(_", "[_", "'", "id", "'_", ",_", "'", "name", "'_", ",_", "'", "zen", "Data", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node", "\\u", "data_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node", "\\u", "obj_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zen", "\\u", "data_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "key_", ",_", "val_", "in_", "node_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "if_", "key_", "==_", "'", "name", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "node", "\\u", "obj_", "=_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "give", " ", "preference", " ", "to", " ", "'", "name", "'", " ", "as", " ", "source", " ", "of", " ", "node", "\\u", "obj_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "key_", "==_", "'", "label", "'_", "and_", "node", "\\u", "obj_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "node", "\\u", "obj_", "=_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "key_", "==_", "'", "zen", "Data", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "zen", "\\u", "data_", "=_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "node", "\\u", "data", " ", "is", " ", "dict", " ", "of", " ", "all", " ", "other", " ", "attributes_", "\\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\t", "\t\t\t\t_", "node", "\\u", "data_", "[_", "key_", "]_", "=_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\\u", "set\\u", " ", "to", " ", "node", "\\u", "data", " ", "else", " ", "\\u", "append", "\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "zen", "\\u", "data_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "if_", "len_", "(_", "node", "\\u", "data_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "node", "\\u", "data_", "=_", "zen", "\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "node", "\\u", "data_", "[_", "'", "zen", "Data", "'_", "]_", "=_", "zen", "\\u", "data_", "\\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_", "len_", "(_", "node", "\\u", "data_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "node", "\\u", "data_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "sure", " ", "tha", "t", " ", "the", " ", "node", " ", "object", " ", "is", " ", "hashable", " ", "other", "wis", "e", " ", "put", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "node", "\\u", "obj_", ",_", "basestring_", ")_", "and_", "node", "\\u", "obj_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "if_", "not_", "isinstance_", "(_", "node", "\\u", "obj_", ",_", "Hash", "able_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "if_", "not_", "isinstance_", "(_", "node", "\\u", "obj_", ",_", "Iterable_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "node", "\\u", "obj_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "node", "\\u", "obj_", "=_", "tuple_", "(_", "node", "\\u", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "bip", "arti", "te", " ", "graph", ",", " ", "this", " ", "insertion", " ", "method", " ", "doe", "s", " ", "not", " ", "guaran", "tee", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tha", "t", " ", "indice", "s", " ", "will", " ", "be", " ", "unchanged", " ", "after", " ", "a", " ", "read", "-", "write", " ", "cycle_", "\\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_", "is", "\\u", "bip", "arti", "te_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "G_", "._", "add", "\\u", "node", "\\u", "by", "\\u", "class_", "(_", "is", "\\u", "in", "\\u", "U_", ",_", "node", "\\u", "obj_", ",_", "node", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "has", "\\u", "id_", "and_", "has", "\\u", "valid", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "if_", "is", "\\u", "directed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "G_", "._", "add", "\\u", "node", "\\u", "x_", "(_", "node", "\\u", "idx_", ",_", "G_", "._", "edge", "\\u", "list", "\\u", "capacity_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "G_", "._", "edge", "\\u", "list", "\\u", "capacity_", ",_", "node", "\\u", "obj_", ",_", "node", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "G_", "._", "add", "\\u", "node", "\\u", "x_", "(_", "node", "\\u", "idx_", ",_", "G_", "._", "edge", "\\u", "list", "\\u", "capacity_", ",_", "node", "\\u", "obj_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "node", "\\u", "data_", ")_", "\\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\t", "\t\t\t_", "if_", "G_", "._", "is", "\\u", "directed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "G_", "._", "add", "\\u", "node_", "(_", "nob", "j_", "=_", "node", "\\u", "obj_", ",_", "data_", "=_", "node", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "G_", "._", "add", "\\u", "node_", "(_", "nob", "j_", "=_", "node", "\\u", "obj_", ",_", "data_", "=_", "node", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "edges_", "\\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_", "if_", "'", "edge", "'_", "in_", "graph", "\\u", "tree_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ensure", " ", "edge", " ", "list", " ", "is", " ", "a", " ", "list", " ", "(", "need", "ed", " ", "if", " ", "there", " ", "is", " ", "only", " ", "one", " ", "edge", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "edges_", "=_", "graph", "\\u", "tree_", "[_", "'", "edge", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "edges_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "edges_", "=_", "[_", "edges_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "iterate", " ", "over", " ", "the", " ", "edge", "s", ",", " ", "add", " ", "each", " ", "one", " ", "to", " ", "the", " ", "graph_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "edge_", "in_", "edges_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "sure", " ", "source", " ", "and", " ", "target", " ", "are", " ", "specified", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "source_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "source", "'_", "not_", "in_", "edge_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "raise_", "Ze", "n", "Exception_", "(_", "'", "Ed", "ge", " ", "is", " ", "missi", "ng", " ", "the", " ", "source", " ", "attribute", " ", "'_", "'(", "edge", " ", "=", " ", "%", "s", ")'_", "%_", "str_", "(_", "edge_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "target", "'_", "not_", "in_", "edge_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "raise_", "Ze", "n", "Exception_", "(_", "'", "Ed", "ge", " ", "is", " ", "missi", "ng", " ", "the", " ", "target", " ", "attribute", " ", "'_", "'(", "edge", " ", "=", " ", "%", "s", ")'_", "%_", "str_", "(_", "edge_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "weight_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "edge", "\\u", "idx_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zen", "\\u", "data_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "edge", "\\u", "data_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "key_", ",_", "val_", "in_", "edge_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "if_", "key_", "==_", "'", "id", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "edge", "\\u", "idx_", "=_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "(_", "val_", ")_", "!=_", "int_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "raise_", "Ze", "n", "Exception_", "(_", "'", "Ed", "ge", " ", "id", " ", "attribute", " ", "must", " ", "be", " ", "a", " ", "'_", "'", "posit", "ive", " ", "integ", "er", " ", "(", "edge", " ", "=", " ", "%", "s", ")'_", "%_", "str_", "(_", "edge_", ")_", ")_", "\\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_", "key_", "==_", "'", "source", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "source_", "=_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "(_", "val_", ")_", "!=_", "int_", "or_", "val_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "raise_", "Ze", "n", "Exception_", "(_", "'", "Ed", "ge", " ", "source", " ", "attribute", " ", "must", " ", "be", " ", "a", " ", "'_", "'", "posit", "ive", " ", "integ", "er", " ", "(", "edge", " ", "=", " ", "%", "s", ")'_", "%_", "str_", "(_", "edge_", ")_", ")_", "\\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_", "key_", "==_", "'", "target", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "target_", "=_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "(_", "val_", ")_", "!=_", "int_", "or_", "val_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "raise_", "Ze", "n", "Exception_", "(_", "'", "Ed", "ge", " ", "target", " ", "attribute", " ", "must", " ", "be", " ", "a", " ", "'_", "'", "posit", "ive", " ", "integ", "er", " ", "(", "edge", " ", "=", " ", "%", "s", ")'_", "%_", "str_", "(_", "edge_", ")_", ")_", "\\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_", "key_", "==_", "'", "weight", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "weight_", "=_", "float_", "(_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "key_", "==_", "'", "zen", "Data", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "zen", "\\u", "data_", "=_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "edge", "\\u", "data", " ", "is", " ", "dict", " ", "of", " ", "all", " ", "other", " ", "attributes_", "\\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\t", "\t\t\t\t_", "edge", "\\u", "data_", "[_", "key_", "]_", "=_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "give", " ", "preceden", "ce", " ", "to", " ", "a", " ", "weight", "-", "getti", "ng", " ", "function", " ", "if", " ", "provided", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "weight", "\\u", "fx", "n_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "weight_", "=_", "weight", "\\u", "fx", "n_", "(_", "edge_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "zen", "Data", " ", "is", " ", "only", " ", "other", " ", "attribute", " ", "asi", "de", " ", "from", " ", "tho", "se", " ", "handle", "d", " ", "above", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\\u", "set\\u", " ", "to", " ", "edge", "\\u", "data", " ", "else", " ", "\\u", "append", "\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "zen", "\\u", "data_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "if_", "len_", "(_", "edge", "\\u", "data_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "edge", "\\u", "data_", "=_", "zen", "\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "edge", "\\u", "data_", "[_", "'", "zen", "Data", "'_", "]_", "=_", "zen", "\\u", "data_", "\\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_", "len_", "(_", "edge", "\\u", "data_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "edge", "\\u", "data_", "=_", "None_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "edge", "\\u", "idx_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "G_", "._", "add", "\\u", "edge", "\\u", "x_", "(_", "edge", "\\u", "idx_", ",_", "source_", ",_", "target_", ",_", "edge", "\\u", "data_", ",_", "weight_", ")_", "\\u\\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_", "G_", "._", "add", "\\u", "edge", "\\u_", "(_", "source_", ",_", "target_", ",_", "edge", "\\u", "data_", ",_", "weight_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "G_", "\\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, 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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 ]
Module is imported with 'import' and 'import from'
gmr/tinman/tinman/session.py
[ { "content": "\"\"\"\nTinman session classes for the management of session data\n\n\"\"\"\nfrom tornado import gen\nimport logging\nimport os\nfrom os import path\nimport tempfile\nimport time\nimport uuid\n\nfrom tinman import config\nfrom tinman import exceptions\nfrom tinman import mapping\n\nLOGGER = logging.getLogger(__name__)\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import os", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 9 } ]
[]
1
true
[ "[CLS]_", "Module_", "is_", "imported_", "with_", "'", "import", "'_", "and_", "'", "import", " ", "from", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Tin", "man", " ", "session", " ", "classe", "s", " ", "for", " ", "the", " ", "manage", "ment", " ", "of", " ", "session", " ", "data", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tornado_", "import_", "gen_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "os_", "import_", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "uuid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "tin", "man_", "import_", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tin", "man_", "import_", "exceptions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tin", "man_", "import_", "mapping_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "LOGGER_", "=_", "logging_", "._", "get", "Logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\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_" ]
[ 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, 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 ]
Imprecise assert
Knewton/pettingzoo-python/pettingzoo/tests/test_discovery.py
[ { "content": "\tdef test_load_config_with_callback(self):\n\t\tself.touched = False\n\t\tself.cbpath = None\n\t\tself.cbconfig = None\n\t\tevent = threading.Event()\n\t\tdef callback(path, config):\n\t\t\tself.touched = True\n\t\t\tself.cbpath = path\n\t\t\tself.cbconfig = config\n\t\t\tevent.set()\n\t\tpettingzoo.discovery.write_distributed_config(\n\t\t\tself.connection, 'mysql', 'reports', self.sample, '127.0.0.1')\n\t\tddc = pettingzoo.discovery.DistributedDiscovery(self.connection)\n\t\tconfig = ddc.load_config('mysql', 'reports', callback=callback)\n\t\tsample2 = {\n\t\t\t'header': {\n\t\t\t\t'service_class': 'mysql', 'metadata': {'version': 1.0}\n\t\t\t},\n\t\t\t'username': 'reports',\n\t\t\t'host': 'notlocalhost',\n\t\t\t'port': 3306,\n\t\t\t'password': 'reports',\n\t\t\t'database': 'reports',\n\t\t\t'encoding': 'utf8'\n\t\t}\n\t\tpettingzoo.discovery.write_distributed_config(\n\t\t\tself.connection, 'mysql', 'reports', sample2, '127.0.0.2')\n\t\tevent.wait(0.25)\n\t\tself.assertTrue(self.touched)\n\t\tself.assertEqual(self.cbpath, '/test_discovery/mysql/reports')\n\t\tconfig = self.cbconfig\n\t\tself.assertTrue(config['host'] in ['localhost', 'notlocalhost'])\n\t\tmismatch_keys = [\n\t\t\tkey for key in self.sample\n\t\t\t\tif not key in config or self.sample[key] != config[key]]\n\t\tfor key in mismatch_keys:\n\t\t\tself.assertTrue(key in ['host', 'header'])", "metadata": "root.DistributedDiscoveryTests.test_load_config_with_callback", "header": "['class', 'DistributedDiscoveryTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 137 }, { "content": "\tdef test_load_config_with_multiple_entries(self):\n\t\tpettingzoo.discovery.write_distributed_config(\n\t\t\tself.connection, 'mysql', 'reports', self.sample, '127.0.0.1')\n\t\tsample2 = {\n\t\t\t'header': {\n\t\t\t\t'service_class': 'mysql', 'metadata': {'version': 1.0}\n\t\t\t},\n\t\t\t'username': 'reports',\n\t\t\t'host': 'notlocalhost',\n\t\t\t'port': 3306,\n\t\t\t'password': 'reports',\n\t\t\t'database': 'reports',\n\t\t\t'encoding': 'utf8'\n\t\t}\n\t\tpettingzoo.discovery.write_distributed_config(\n\t\t\tself.connection, 'mysql', 'reports', sample2, '127.0.0.2')\n\t\tddc = pettingzoo.discovery.DistributedDiscovery(self.connection)\n\t\tconfig = ddc.load_config('mysql', 'reports')\n\t\tmismatch_keys = [\n\t\t\tkey for key in self.sample\n\t\t\t\tif not key in config or self.sample[key] != config[key]]\n\t\tfor key in mismatch_keys:\n\t\t\tself.assertTrue(key in ['host', 'header'])", "metadata": "root.DistributedDiscoveryTests.test_load_config_with_multiple_entries", "header": "['class', 'DistributedDiscoveryTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 175 }, { "content": "\tdef test_config_file_list_fallback_dc(self):\n\t\tddc = pettingzoo.discovery.DistributedDiscovery(self.connection)\n\t\tconfig = ddc.load_config('mysql', 'list')\n\t\tself.assertEquals(config, self.sample)\n\t\tconfig = ddc.load_config('mysql', 'mlist')\n\t\tself.assertTrue(config in [self.sample, self.sample2])", "metadata": "root.FileFallbackTests.test_config_file_list_fallback_dc", "header": "['class', 'FileFallbackTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 333 } ]
[ { "span": "self.assertTrue(config['host'] in ['localhost', 'notlocalhost'])", "start_line": 168, "start_column": 2, "end_line": 168, "end_column": 66 }, { "span": "self.assertTrue(key in ['host', 'header'])", "start_line": 173, "start_column": 3, "end_line": 173, "end_column": 45 }, { "span": "self.assertTrue(key in ['host', 'header'])", "start_line": 197, "start_column": 3, "end_line": 197, "end_column": 45 }, { "span": "self.assertTrue(config in [self.sample, self.sample2])", "start_line": 338, "start_column": 2, "end_line": 338, "end_column": 56 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Distribut", "ed", "Discover", "y", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "load", "\\u", "config", "\\u", "with", "\\u", "callback_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "self_", "._", "touche", "d_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cb", "path_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cbc", "onfig_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "threading_", "._", "Event_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "callback_", "(_", "path_", ",_", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "self_", "._", "touche", "d_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cb", "path_", "=_", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cbc", "onfig_", "=_", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "._", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pet", "ting", "zoo", "_", "._", "discovery_", "._", "write", "\\u", "distributed", "\\u", "config_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "connection_", ",_", "'", "mysql", "'_", ",_", "'", "report", "s", "'_", ",_", "self_", "._", "sample_", ",_", "'", "127", ".0", ".0", ".1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dd", "c_", "=_", "pet", "ting", "zoo", "_", "._", "discovery_", "._", "Distribut", "ed", "Discover", "y_", "(_", "self_", "._", "connection_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "=_", "dd", "c_", "._", "load", "\\u", "config_", "(_", "'", "mysql", "'_", ",_", "'", "report", "s", "'_", ",_", "callback_", "=_", "callback_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sample", "2_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "service", "\\u", "class", "'_", ":_", "'", "mysql", "'_", ",_", "'", "metadata", "'_", ":_", "{_", "'", "version", "'_", ":_", "1.0_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "name", "'_", ":_", "'", "report", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "host", "'_", ":_", "'", "not", "local", "host", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "3306", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "password", "'_", ":_", "'", "report", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "databa", "se", "'_", ":_", "'", "report", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "encoding", "'_", ":_", "'", "utf", "8", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pet", "ting", "zoo", "_", "._", "discovery_", "._", "write", "\\u", "distributed", "\\u", "config_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "connection_", ",_", "'", "mysql", "'_", ",_", "'", "report", "s", "'_", ",_", "sample", "2_", ",_", "'", "127", ".0", ".0", ".2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "._", "wait_", "(_", "0.25_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "touche", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "cb", "path_", ",_", "'/", "test\\u", "discove", "ry", "/", "mysql", "/", "report", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "=_", "self_", "._", "cbc", "onfig_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "config_", "[_", "'", "host", "'_", "]_", "in_", "[_", "'", "local", "host", "'_", ",_", "'", "not", "local", "host", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mism", "atch", "\\u", "keys_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "key_", "for_", "key_", "in_", "self_", "._", "sample_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "key_", "in_", "config_", "or_", "self_", "._", "sample_", "[_", "key_", "]_", "!=_", "config_", "[_", "key_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", "in_", "mism", "atch", "\\u", "keys_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "self_", "._", "assert", "True_", "(_", "key_", "in_", "[_", "'", "host", "'_", ",_", "'", "header", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Distribut", "ed", "Discover", "y", "Tests_", "(_", "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", "load", "\\u", "config", "\\u", "with", "\\u", "multiple", "\\u", "entries_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "pet", "ting", "zoo", "_", "._", "discovery_", "._", "write", "\\u", "distributed", "\\u", "config_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "connection_", ",_", "'", "mysql", "'_", ",_", "'", "report", "s", "'_", ",_", "self_", "._", "sample_", ",_", "'", "127", ".0", ".0", ".1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sample", "2_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "service", "\\u", "class", "'_", ":_", "'", "mysql", "'_", ",_", "'", "metadata", "'_", ":_", "{_", "'", "version", "'_", ":_", "1.0_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "name", "'_", ":_", "'", "report", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "host", "'_", ":_", "'", "not", "local", "host", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "3306", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "password", "'_", ":_", "'", "report", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "databa", "se", "'_", ":_", "'", "report", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "encoding", "'_", ":_", "'", "utf", "8", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pet", "ting", "zoo", "_", "._", "discovery_", "._", "write", "\\u", "distributed", "\\u", "config_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "connection_", ",_", "'", "mysql", "'_", ",_", "'", "report", "s", "'_", ",_", "sample", "2_", ",_", "'", "127", ".0", ".0", ".2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dd", "c_", "=_", "pet", "ting", "zoo", "_", "._", "discovery_", "._", "Distribut", "ed", "Discover", "y_", "(_", "self_", "._", "connection_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "=_", "dd", "c_", "._", "load", "\\u", "config_", "(_", "'", "mysql", "'_", ",_", "'", "report", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mism", "atch", "\\u", "keys_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "key_", "for_", "key_", "in_", "self_", "._", "sample_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "key_", "in_", "config_", "or_", "self_", "._", "sample_", "[_", "key_", "]_", "!=_", "config_", "[_", "key_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", "in_", "mism", "atch", "\\u", "keys_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "self_", "._", "assert", "True_", "(_", "key_", "in_", "[_", "'", "host", "'_", ",_", "'", "header", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "File", "Fallback", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "config", "\\u", "file", "\\u", "list", "\\u", "fall", "back", "\\u", "dc_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "dd", "c_", "=_", "pet", "ting", "zoo", "_", "._", "discovery_", "._", "Distribut", "ed", "Discover", "y_", "(_", "self_", "._", "connection_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "=_", "dd", "c_", "._", "load", "\\u", "config_", "(_", "'", "mysql", "'_", ",_", "'", "list", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "config_", ",_", "self_", "._", "sample_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "=_", "dd", "c_", "._", "load", "\\u", "config_", "(_", "'", "mysql", "'_", ",_", "'", "mli", "st", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "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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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Redundant comparison
Tanganelli/CoAPthon/coapthon/messages/message.py
[ { "content": " @block1.setter\n def block1(self, value):\n \"\"\"\n Set the Block1 option.\n\n :param value: the Block1 value\n \"\"\"\n option = Option()\n option.number = defines.OptionRegistry.BLOCK1.number\n num, m, size = value\n if size > 512:\n szx = 6\n elif 256 < size <= 512:\n szx = 5\n elif 128 < size <= 256:\n szx = 4\n elif 64 < size <= 128:\n szx = 3\n elif 32 < size <= 64:\n szx = 2\n elif 16 < size <= 32:\n szx = 1\n else:\n szx = 0\n\n value = (num << 4)\n value |= (m << 3)\n value |= szx\n\n option.value = value\n self.add_option(option)", "metadata": "root.Message.block1", "header": "['class', 'Message', '(', 'object', ')', ':', '___EOS___']", "index": 500 }, { "content": " @block2.setter\n def block2(self, value):\n option = Option()\n option.number = defines.OptionRegistry.BLOCK2.number\n num, m, size = value\n if size > 512:\n szx = 6\n elif 256 < size <= 512:\n szx = 5\n elif 128 < size <= 256:\n szx = 4\n elif 64 < size <= 128:\n szx = 3\n elif 32 < size <= 64:\n szx = 2\n elif 16 < size <= 32:\n szx = 1\n else:\n szx = 0\n\n value = (num << 4)\n value |= (m << 3)\n value |= szx\n\n option.value = value\n self.add_option(option)", "metadata": "root.Message.block2", "header": "['class', 'Message', '(', 'object', ')', ':', '___EOS___']", "index": 548 } ]
[ { "span": "256 < size <= 512:", "start_line": 512, "start_column": 13, "end_line": 512, "end_column": 30 }, { "span": "256 < size <= 512:", "start_line": 555, "start_column": 13, "end_line": 555, "end_column": 30 } ]
[ { "span": "size > 512:", "start_line": 510, "start_column": 11, "end_line": 510, "end_column": 21 }, { "span": "size > 512:", "start_line": 553, "start_column": 11, "end_line": 553, "end_column": 21 } ]
1
true
[ "[CLS]_", "Redu", "ndan", "t_", "comparison_", "[SEP]_", "class_", "Message_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "block", "1_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "block", "1_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Set", " ", "the", " ", "Block", "1", " ", "option", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "value", ":", " ", "the", " ", "Block", "1", " ", "value", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "option_", "=_", "Option_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "option_", "._", "number_", "=_", "defines_", "._", "Optio", "n", "Registry_", "._", "BLOCK", "1_", "._", "number_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num_", ",_", "m_", ",_", "size_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "size_", ">_", "512_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sz", "x_", "=_", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "256_", "<_", "size_", "<=_", "512_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sz", "x_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "128_", "<_", "size_", "<=_", "256_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sz", "x_", "=_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "64_", "<_", "size_", "<=_", "128_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sz", "x_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "32_", "<_", "size_", "<=_", "64_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sz", "x_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "16_", "<_", "size_", "<=_", "32_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sz", "x_", "=_", "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 ", " _", "sz", "x_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "value_", "=_", "(_", "num_", "<<_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "|=_", "(_", "m_", "<<_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "|=_", "sz", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "option_", "._", "value_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "\\u", "option_", "(_", "option_", ")_", "\\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_", "@_", "block", "2_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "block", "2_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "option_", "=_", "Option_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "option_", "._", "number_", "=_", "defines_", "._", "Optio", "n", "Registry_", "._", "BLOCK", "2_", "._", "number_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num_", ",_", "m_", ",_", "size_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "size_", ">_", "512_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sz", "x_", "=_", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "256_", "<_", "size_", "<=_", "512_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sz", "x_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "128_", "<_", "size_", "<=_", "256_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sz", "x_", "=_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "64_", "<_", "size_", "<=_", "128_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sz", "x_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "32_", "<_", "size_", "<=_", "64_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sz", "x_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "16_", "<_", "size_", "<=_", "32_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sz", "x_", "=_", "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 ", " _", "sz", "x_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "value_", "=_", "(_", "num_", "<<_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "|=_", "(_", "m_", "<<_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "|=_", "sz", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "option_", "._", "value_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "\\u", "option_", "(_", "option_", ")_", "\\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, 3, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 3, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Suspicious unused loop iteration variable
sahana/eden/modules/tests/smoke/broken_links.py
[ { "content": " def report_timings_summary(self,\n summary,\n summary_file_name = None,\n mean_threshold = 1):\n \"\"\"\n This will extract the details from the sheet and optionally save\n them to a summary file\n\n summary: the summary details returned from the spreadsheet (read_timings_sheet)\n summary_file_name: name of the file to record the summary details (if required)\n mean_threshold: The minimum number of values required to include\n the mean in the regression calculations\n \"\"\"\n import numpy\n import datetime\n good_values = []\n other_values = []\n total_values = []\n for date in summary[\"date\"]:\n good_values.append([])\n other_values.append([])\n total_values.append([])\n for (url,results) in summary.items():\n if url == \"date\":\n continue\n else:\n cnt = 0\n for (duration, broken) in results:\n if duration != \"\":\n total_values[cnt].append(duration)\n if broken:\n other_values[cnt].append(duration)\n else:\n good_values[cnt].append(duration)\n cnt += 1\n # get the number of days each entry is after the first date\n # and calculate the average, if the average is NAN then ignore both\n date_summary = []\n gv_mean = []\n gv_std = []\n gv_date = []\n cnt = 0\n start = datetime.datetime.strptime(summary[\"date\"][0],\"%Y-%m-%d\")\n for list in good_values:\n if len(list) > mean_threshold:\n mean = numpy.mean(list)\n std = numpy.std(list)\n if not numpy.isnan(mean):\n this_date = datetime.datetime.strptime(summary[\"date\"][cnt],\"%Y-%m-%d\")\n date_summary.append((this_date - start).days)\n gv_mean.append(mean)\n gv_std.append(std)\n gv_date.append(summary[\"date\"][cnt])\n cnt += 1\n # calculate the regression line\n if len(gv_mean) > 2:\n (m,b) = numpy.polyfit(date_summary, gv_mean, 1)\n else:\n m = b = 0\n\n if summary_file_name != None:\n book = self.write_timings_sheet(summary)\n sheet = book.add_sheet(\"summary\")\n row = 0\n for date in gv_date:\n sheet.write(row,0,str(date))\n sheet.write(row,1,gv_mean[row])\n row += 1\n sheet.write(row,0,\"Trend\")\n sheet.write(row,1,m)\n # Save the details to the summary file\n book.save(summary_file_name)\n return (date_summary, gv_mean, gv_std, m, b)", "metadata": "root.BrokenLinkTest.report_timings_summary", "header": "['class', 'BrokenLinkTest', '(', 'Web2UnitTest', ')', ':', '___EOS___']", "index": 403 } ]
[ { "span": "for date in summary[\"date\"]:", "start_line": 421, "start_column": 8, "end_line": 421, "end_column": 36 } ]
[]
1
true
[ "[CLS]_", "Sus", "picio", "us_", "unused_", "loop_", "iteration_", "variable_", "[SEP]_", "class_", "Bro", "ken", "Link", "Test_", "(_", "Web", "2", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "report", "\\u", "timings", "\\u", "summary_", "(_", "self_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "summary_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "summar", "y", "\\u", "file", "\\u", "name_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mean", "\\u", "threshold_", "=_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "will", " ", "extract", " ", "the", " ", "deta", "il", "s", " ", "from", " ", "the", " ", "sheet", " ", "and", " ", "option", "ally", " ", "save", "\\", "10", ";", " ", " ", " ", " ", "them", " ", "to", " ", "a", " ", "summar", "y", " ", "file", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "summar", "y", ":", " ", "the", " ", "summar", "y", " ", "deta", "il", "s", " ", "return", "ed", " ", "from", " ", "the", " ", "spreadsheet", " ", "(", "read", "\\u", "timings", "\\u", "sheet", ")", "\\", "10", ";", " ", " ", " ", " ", "summar", "y", "\\u", "file", "\\u", "name", ":", " ", "name", " ", "of", " ", "the", " ", "file", " ", "to", " ", "record", " ", "the", " ", "summar", "y", " ", "deta", "il", "s", " ", "(", "if", " ", "require", "d", ")", "\\", "10", ";", " ", " ", " ", " ", "mean", "\\u", "threshol", "d", ":", " ", "The", " ", "minim", "um", " ", "number", " ", "of", " ", "values", " ", "require", "d", " ", "to", " ", "include", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "the", " ", "mean", " ", "in", " ", "the", " ", "regress", "ion", " ", "calculati", "ons", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "good", "\\u", "values_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other", "\\u", "values_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total", "\\u", "values_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "date_", "in_", "summary_", "[_", "\"", "date", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "good", "\\u", "values_", "._", "append_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other", "\\u", "values_", "._", "append_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total", "\\u", "values_", "._", "append_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "(_", "url_", ",_", "results_", ")_", "in_", "summary_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "url_", "==_", "\"", "date", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cnt_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "(_", "duration_", ",_", "broken", "_", ")_", "in_", "results_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "duration_", "!=_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "total", "\\u", "values_", "[_", "cnt_", "]_", "._", "append_", "(_", "duration_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "broken", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "other", "\\u", "values_", "[_", "cnt_", "]_", "._", "append_", "(_", "duration_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "good", "\\u", "values_", "[_", "cnt_", "]_", "._", "append_", "(_", "duration_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cnt_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "the", " ", "number", " ", "of", " ", "day", "s", " ", "each", " ", "entry", " ", "is", " ", "after", " ", "the", " ", "first", " ", "date_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "calcul", "ate", " ", "the", " ", "averag", "e", ",", " ", "if", " ", "the", " ", "averag", "e", " ", "is", " ", "NAN", " ", "then", " ", "ignore", " ", "both_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "date", "\\u", "summary_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gv", "\\u", "mean_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gv", "\\u", "std_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gv", "\\u", "date_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cnt_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start_", "=_", "datetime_", "._", "datetime_", "._", "strptime_", "(_", "summary_", "[_", "\"", "date", "\"_", "]_", "[_", "0_", "]_", ",_", "\"%", "Y", "-%", "m", "-%", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "list_", "in_", "good", "\\u", "values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "list_", ")_", ">_", "mean", "\\u", "threshold_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mean_", "=_", "numpy_", "._", "mean_", "(_", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "std_", "=_", "numpy_", "._", "std_", "(_", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "numpy_", "._", "isnan_", "(_", "mean_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "this", "\\u", "date_", "=_", "datetime_", "._", "datetime_", "._", "strptime_", "(_", "summary_", "[_", "\"", "date", "\"_", "]_", "[_", "cnt_", "]_", ",_", "\"%", "Y", "-%", "m", "-%", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "date", "\\u", "summary_", "._", "append_", "(_", "(_", "this", "\\u", "date_", "-_", "start_", ")_", "._", "days_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gv", "\\u", "mean_", "._", "append_", "(_", "mean_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gv", "\\u", "std_", "._", "append_", "(_", "std_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gv", "\\u", "date_", "._", "append_", "(_", "summary_", "[_", "\"", "date", "\"_", "]_", "[_", "cnt_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cnt_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "calcul", "ate", " ", "the", " ", "regress", "ion", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "gv", "\\u", "mean_", ")_", ">_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "m_", ",_", "b_", ")_", "=_", "numpy_", "._", "polyf", "it_", "(_", "date", "\\u", "summary_", ",_", "gv", "\\u", "mean_", ",_", "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 ", " _", "m_", "=_", "b_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "summar", "y", "\\u", "file", "\\u", "name_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "book_", "=_", "self_", "._", "write", "\\u", "timings", "\\u", "sheet_", "(_", "summary_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sheet_", "=_", "book_", "._", "add", "\\u", "sheet_", "(_", "\"", "summar", "y", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "row_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "date_", "in_", "gv", "\\u", "date_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sheet_", "._", "write_", "(_", "row_", ",_", "0_", ",_", "str_", "(_", "date_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sheet_", "._", "write_", "(_", "row_", ",_", "1_", ",_", "gv", "\\u", "mean_", "[_", "row_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "row_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sheet_", "._", "write_", "(_", "row_", ",_", "0_", ",_", "\"", "Tren", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sheet_", "._", "write_", "(_", "row_", ",_", "1_", ",_", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Save", " ", "the", " ", "deta", "il", "s", " ", "to", " ", "the", " ", "summar", "y", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "book_", "._", "save_", "(_", "summar", "y", "\\u", "file", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "date", "\\u", "summary_", ",_", "gv", "\\u", "mean_", ",_", "gv", "\\u", "std_", ",_", "m_", ",_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Except block handles 'BaseException'
django-erp/django-erp/djangoerp/core/views.py
[ { "content": " def get_success_url(self):\n try:\n return self.request.GET.get('next', self.success_url or clean_http_referer(self.request))\n except:\n return super(SetSuccessUrlMixin, self).get_success_url()", "metadata": "root.SetSuccessUrlMixin.get_success_url", "header": "['class', 'SetSuccessUrlMixin', '(', 'object', ')', ':', '___EOS___']", "index": 45 } ]
[ { "span": "except:", "start_line": 48, "start_column": 8, "end_line": 48, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Set", "Success", "Ur", "l", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "success", "\\u", "url_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "request_", "._", "GET_", "._", "get_", "(_", "'", "next", "'_", ",_", "self_", "._", "success", "\\u", "url_", "or_", "clean", "\\u", "http", "\\u", "referer_", "(_", "self_", "._", "request_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "super_", "(_", "Set", "Success", "Ur", "l", "Mixin_", ",_", "self_", ")_", "._", "get", "\\u", "success", "\\u", "url_", "(_", ")_" ]
[ 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, 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 ]
Unused local variable
diefenbach/django-lfs/lfs/marketing/tests.py
[ { "content": " def test_topseller_3(self):\n \"\"\"Tests general topseller with explicitly assigned products which\n are also in calculated topsellers.\n \"\"\"\n ts = lfs.marketing.utils.get_topseller(2)\n\n self.assertEqual(len(ts), 2)\n\n self.assertEqual(ts[0], self.p4)\n self.assertEqual(ts[1], self.p3)\n\n # Explicit topseller P4, which is already a topseller\n t = Topseller.objects.create(product=self.p4, position=1)\n\n # P4 should only displayed once\n ts = lfs.marketing.utils.get_topseller(2)\n self.assertEqual(ts[0], self.p4)\n self.assertEqual(ts[1], self.p3)", "metadata": "root.TopsellerUtilsTestCase.test_topseller_3", "header": "['class', 'TopsellerUtilsTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 170 }, { "content": " def test_topseller_for_category_3(self):\n \"\"\"Tests the top seller for specific categories. With explicitly\n selected products and ca\n \"\"\"\n # Tests the top level category\n ts = lfs.marketing.utils.get_topseller_for_category(self.c1, limit=2)\n self.assertEqual(len(ts), 2)\n\n self.assertEqual(ts[0], self.p4)\n self.assertEqual(ts[1], self.p3)\n\n # Explicit topseller P4 for c1, which is already a topseller\n t = Topseller.objects.create(product=self.p4, position=1)\n\n # Tests the top level category\n ts = lfs.marketing.utils.get_topseller_for_category(self.c1, limit=2)\n self.assertEqual(len(ts), 2)\n\n self.assertEqual(ts[0], self.p4)\n self.assertEqual(ts[1], self.p3)\n\n # Tests the direct categories\n ts = lfs.marketing.utils.get_topseller_for_category(self.c12, limit=2)\n self.assertEqual(len(ts), 2)\n\n self.assertEqual(ts[0], self.p4)\n self.assertEqual(ts[1], self.p3)", "metadata": "root.TopsellerUtilsTestCase.test_topseller_for_category_3", "header": "['class', 'TopsellerUtilsTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 268 } ]
[ { "span": "t ", "start_line": 182, "start_column": 8, "end_line": 182, "end_column": 9 }, { "span": "t ", "start_line": 280, "start_column": 8, "end_line": 280, "end_column": 9 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Top", "seller", "Ut", "il", "s", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "tops", "elle", "r", "\\u", "3_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", "s", " ", "genera", "l", " ", "tops", "elle", "r", " ", "with", " ", "explicit", "ly", " ", "assign", "ed", " ", "products", " ", "whi", "ch", "\\", "10", ";", " ", " ", " ", " ", "are", " ", "als", "o", " ", "in", " ", "calculated", " ", "tops", "elle", "rs", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ts_", "=_", "lf", "s_", "._", "market", "ing_", "._", "utils_", "._", "get", "\\u", "tops", "elle", "r_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "ts_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ts_", "[_", "0_", "]_", ",_", "self_", "._", "p4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ts_", "[_", "1_", "]_", ",_", "self_", "._", "p3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Exp", "licit", " ", "tops", "elle", "r", " ", "P4", ",", " ", "whi", "ch", " ", "is", " ", "alr", "ead", "y", " ", "a", " ", "tops", "elle", "r_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "Top", "seller", "_", "._", "objects_", "._", "create_", "(_", "product_", "=_", "self_", "._", "p4_", ",_", "position_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "P4", " ", "shou", "ld", " ", "only", " ", "displaye", "d", " ", "once_", "\\u\\u\\uNL\\u\\u\\u_", "ts_", "=_", "lf", "s_", "._", "market", "ing_", "._", "utils_", "._", "get", "\\u", "tops", "elle", "r_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ts_", "[_", "0_", "]_", ",_", "self_", "._", "p4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ts_", "[_", "1_", "]_", ",_", "self_", "._", "p3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Top", "seller", "Ut", "il", "s", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "tops", "elle", "r", "\\u", "for", "\\u", "category", "\\u", "3_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", "s", " ", "the", " ", "top", " ", "seller", " ", "for", " ", "specific", " ", "categor", "ies", ".", " ", "With", " ", "explicit", "ly", "\\", "10", ";", " ", " ", " ", " ", "selecte", "d", " ", "products", " ", "and", " ", "ca", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Test", "s", " ", "the", " ", "top", " ", "level", " ", "category_", "\\u\\u\\uNL\\u\\u\\u_", "ts_", "=_", "lf", "s_", "._", "market", "ing_", "._", "utils_", "._", "get", "\\u", "tops", "elle", "r", "\\u", "for", "\\u", "category_", "(_", "self_", "._", "c1_", ",_", "limit_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "ts_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ts_", "[_", "0_", "]_", ",_", "self_", "._", "p4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ts_", "[_", "1_", "]_", ",_", "self_", "._", "p3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Exp", "licit", " ", "tops", "elle", "r", " ", "P4", " ", "for", " ", "c1", ",", " ", "whi", "ch", " ", "is", " ", "alr", "ead", "y", " ", "a", " ", "tops", "elle", "r_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "Top", "seller", "_", "._", "objects_", "._", "create_", "(_", "product_", "=_", "self_", "._", "p4_", ",_", "position_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", "s", " ", "the", " ", "top", " ", "level", " ", "category_", "\\u\\u\\uNL\\u\\u\\u_", "ts_", "=_", "lf", "s_", "._", "market", "ing_", "._", "utils_", "._", "get", "\\u", "tops", "elle", "r", "\\u", "for", "\\u", "category_", "(_", "self_", "._", "c1_", ",_", "limit_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "ts_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ts_", "[_", "0_", "]_", ",_", "self_", "._", "p4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ts_", "[_", "1_", "]_", ",_", "self_", "._", "p3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", "s", " ", "the", " ", "direct", " ", "categories_", "\\u\\u\\uNL\\u\\u\\u_", "ts_", "=_", "lf", "s_", "._", "market", "ing_", "._", "utils_", "._", "get", "\\u", "tops", "elle", "r", "\\u", "for", "\\u", "category_", "(_", "self_", "._", "c1", "2_", ",_", "limit_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "ts_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ts_", "[_", "0_", "]_", ",_", "self_", "._", "p4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ts_", "[_", "1_", "]_", ",_", "self_", "._", "p3_", ")_" ]
[ 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,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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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
myusuf3/delorean/tests/delorean_tests.py
[ { "content": " def test_lt(self):\n dt1 = self.do\n dt2 = delorean.Delorean()\n self.assertTrue(dt1 < dt2)", "metadata": "root.DeloreanTests.test_lt", "header": "['class', 'DeloreanTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 611 }, { "content": " def test_gt(self):\n dt1 = self.do\n dt2 = delorean.Delorean()\n self.assertTrue(dt2 > dt1)", "metadata": "root.DeloreanTests.test_gt", "header": "['class', 'DeloreanTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 616 }, { "content": " def test_ge(self):\n dt = datetime.utcnow()\n dt1 = delorean.Delorean(dt, timezone=\"UTC\")\n dt2 = delorean.Delorean(dt, timezone=\"UTC\")\n dt3 = self.do\n self.assertTrue(dt2 >= dt1)\n self.assertTrue(dt1 >= dt3)", "metadata": "root.DeloreanTests.test_ge", "header": "['class', 'DeloreanTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 621 }, { "content": " def test_le(self):\n dt = datetime.utcnow()\n dt1 = delorean.Delorean(dt, timezone=\"UTC\")\n dt2 = delorean.Delorean(dt, timezone=\"UTC\")\n dt3 = self.do\n self.assertTrue(dt2 <= dt1)\n self.assertTrue(dt3 <= dt2)", "metadata": "root.DeloreanTests.test_le", "header": "['class', 'DeloreanTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 629 }, { "content": " def test_stops_bymonth(self):\n \"\"\"Test if create stops, checks bymonth, bymonthday, count\n and start parameters work properly\n \"\"\"\n days = list(delorean.interface.stops(\n delorean.MONTHLY,\n bymonth=(1, 4, 7, 10),\n bymonthday=15,\n count=4,\n start=datetime(datetime.now().year, 1, 1))\n )\n year = datetime.now().year\n day = 15\n dt1 = datetime(year, 1, day)\n dt4 = datetime(year, 4, day)\n dt7 = datetime(year, 7, day)\n dt10 = datetime(year, 10, day)\n\n self.assertTrue(len(days) == 4)\n dl1 = delorean.Delorean(datetime=dt1, timezone='UTC')\n self.assertEqual(days[0], dl1)\n\n dl4 = delorean.Delorean(datetime=dt4, timezone='UTC')\n self.assertEqual(days[1], dl4)\n\n dl7 = delorean.Delorean(datetime=dt7, timezone='UTC')\n self.assertEqual(days[2], dl7)\n\n dl10 = delorean.Delorean(datetime=dt10, timezone='UTC')\n self.assertEqual(days[3], dl10)", "metadata": "root.DeloreanTests.test_stops_bymonth", "header": "['class', 'DeloreanTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 721 } ]
[ { "span": "self.assertTrue(dt1 < dt2)", "start_line": 614, "start_column": 8, "end_line": 614, "end_column": 34 }, { "span": "self.assertTrue(dt2 > dt1)", "start_line": 619, "start_column": 8, "end_line": 619, "end_column": 34 }, { "span": "self.assertTrue(dt2 >= dt1)", "start_line": 626, "start_column": 8, "end_line": 626, "end_column": 35 }, { "span": "self.assertTrue(dt1 >= dt3)", "start_line": 627, "start_column": 8, "end_line": 627, "end_column": 35 }, { "span": "self.assertTrue(dt2 <= dt1)", "start_line": 634, "start_column": 8, "end_line": 634, "end_column": 35 }, { "span": "self.assertTrue(dt3 <= dt2)", "start_line": 635, "start_column": 8, "end_line": 635, "end_column": 35 }, { "span": "self.assertTrue(len(days) == 4)", "start_line": 739, "start_column": 8, "end_line": 739, "end_column": 39 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Del", "ore", "an", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "lt_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dt", "1_", "=_", "self_", "._", "do_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dt", "2_", "=_", "del", "ore", "an_", "._", "Del", "ore", "an_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "dt", "1_", "<_", "dt", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Del", "ore", "an", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "gt_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dt", "1_", "=_", "self_", "._", "do_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dt", "2_", "=_", "del", "ore", "an_", "._", "Del", "ore", "an_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "dt", "2_", ">_", "dt", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Del", "ore", "an", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "ge_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dt_", "=_", "datetime_", "._", "utcnow_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dt", "1_", "=_", "del", "ore", "an_", "._", "Del", "ore", "an_", "(_", "dt_", ",_", "timezone_", "=_", "\"", "UT", "C", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dt", "2_", "=_", "del", "ore", "an_", "._", "Del", "ore", "an_", "(_", "dt_", ",_", "timezone_", "=_", "\"", "UT", "C", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dt", "3_", "=_", "self_", "._", "do_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "dt", "2_", ">=_", "dt", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "dt", "1_", ">=_", "dt", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Del", "ore", "an", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "le_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dt_", "=_", "datetime_", "._", "utcnow_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dt", "1_", "=_", "del", "ore", "an_", "._", "Del", "ore", "an_", "(_", "dt_", ",_", "timezone_", "=_", "\"", "UT", "C", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dt", "2_", "=_", "del", "ore", "an_", "._", "Del", "ore", "an_", "(_", "dt_", ",_", "timezone_", "=_", "\"", "UT", "C", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dt", "3_", "=_", "self_", "._", "do_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "dt", "2_", "<=_", "dt", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "dt", "3_", "<=_", "dt", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Del", "ore", "an", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "stop", "s", "\\u", "by", "month_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "if", " ", "create", " ", "stop", "s", ",", " ", "checks", " ", "by", "month", ",", " ", "by", "month", "day", ",", " ", "count", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "start", " ", "parameter", "s", " ", "work", " ", "proper", "ly", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "days_", "=_", "list_", "(_", "del", "ore", "an_", "._", "interface_", "._", "stops_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "del", "ore", "an_", "._", "MONTH", "LY_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "by", "month_", "=_", "(_", "1_", ",_", "4_", ",_", "7_", ",_", "10_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "by", "month", "day_", "=_", "15_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "count_", "=_", "4_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start_", "=_", "datetime_", "(_", "datetime_", "._", "now_", "(_", ")_", "._", "year_", ",_", "1_", ",_", "1_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "year_", "=_", "datetime_", "._", "now_", "(_", ")_", "._", "year_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "day_", "=_", "15_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dt", "1_", "=_", "datetime_", "(_", "year_", ",_", "1_", ",_", "day_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dt", "4_", "=_", "datetime_", "(_", "year_", ",_", "4_", ",_", "day_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dt", "7_", "=_", "datetime_", "(_", "year_", ",_", "7_", ",_", "day_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dt", "10_", "=_", "datetime_", "(_", "year_", ",_", "10_", ",_", "day_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "days_", ")_", "==_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dl", "1_", "=_", "del", "ore", "an_", "._", "Del", "ore", "an_", "(_", "datetime_", "=_", "dt", "1_", ",_", "timezone_", "=_", "'", "UT", "C", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "days_", "[_", "0_", "]_", ",_", "dl", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dl", "4_", "=_", "del", "ore", "an_", "._", "Del", "ore", "an_", "(_", "datetime_", "=_", "dt", "4_", ",_", "timezone_", "=_", "'", "UT", "C", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "days_", "[_", "1_", "]_", ",_", "dl", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dl", "7_", "=_", "del", "ore", "an_", "._", "Del", "ore", "an_", "(_", "datetime_", "=_", "dt", "7_", ",_", "timezone_", "=_", "'", "UT", "C", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "days_", "[_", "2_", "]_", ",_", "dl", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dl", "10_", "=_", "del", "ore", "an_", "._", "Del", "ore", "an_", "(_", "datetime_", "=_", "dt", "10_", ",_", "timezone_", "=_", "'", "UT", "C", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "days_", "[_", "3_", "]_", ",_", "dl", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
mattupstate/flask-security/flask_security/decorators.py
[ { "content": "# -*- coding: utf-8 -*-\n\"\"\"\n flask_security.decorators\n ~~~~~~~~~~~~~~~~~~~~~~~~~\n\n Flask-Security decorators module\n\n :copyright: (c) 2012 by Matt Wright.\n :license: MIT, see LICENSE for more details.\n\"\"\"\n\nfrom collections import namedtuple\nfrom functools import wraps\n\nfrom flask import (abort, current_app, Response, request,\n url_for, redirect, _request_ctx_stack)\nfrom flask_login import current_user, login_required # pragma: no flakes\nfrom flask_principal import RoleNeed, Permission, Identity, identity_changed\nfrom werkzeug.local import LocalProxy\nfrom werkzeug.routing import BuildError\n\nfrom . import utils\n\n\n# Convenient references\n_security = LocalProxy(lambda: current_app.extensions['security'])\n\n\n_default_unauthorized_html = \"\"\"\n <h1>Unauthorized</h1>\n <p>The server could not verify that you are authorized to access the URL\n requested. You either supplied the wrong credentials (e.g. a bad password),\n or your browser doesn't understand how to supply the credentials required.</p>\n \"\"\"\n\nBasicAuth = namedtuple('BasicAuth', 'username, password')\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def _get_unauthorized_response(text=None, headers=None):\n text = text or _default_unauthorized_html\n headers = headers or {}\n return Response(text, 401, headers)", "metadata": "root._get_unauthorized_response", "header": "['module', '___EOS___']", "index": 38 }, { "content": "def _get_unauthorized_view():\n view = utils.get_url(utils.config_value('UNAUTHORIZED_VIEW'))\n if view:\n if callable(view):\n view = view()\n else:\n try:\n view = url_for(view)\n except BuildError:\n view = None\n utils.do_flash(*utils.get_message('UNAUTHORIZED'))\n return redirect(view or request.referrer or '/')\n abort(403)", "metadata": "root._get_unauthorized_view", "header": "['module', '___EOS___']", "index": 44 }, { "content": "def _check_token():\n header_key = _security.token_authentication_header\n args_key = _security.token_authentication_key\n header_token = request.headers.get(header_key, None)\n token = request.args.get(args_key, header_token)\n if request.get_json(silent=True):\n if not isinstance(request.json, list):\n token = request.json.get(args_key, token)\n\n user = _security.login_manager.token_callback(token)\n\n if user and user.is_authenticated:\n app = current_app._get_current_object()\n _request_ctx_stack.top.user = user\n identity_changed.send(app, identity=Identity(user.id))\n return True\n\n return False", "metadata": "root._check_token", "header": "['module', '___EOS___']", "index": 59 }, { "content": "def _check_http_auth():\n auth = request.authorization or BasicAuth(username=None, password=None)\n user = _security.datastore.find_user(email=auth.username)\n\n if user and utils.verify_and_update_password(auth.password, user):\n _security.datastore.commit()\n app = current_app._get_current_object()\n _request_ctx_stack.top.user = user\n identity_changed.send(app, identity=Identity(user.id))\n return True\n\n return False", "metadata": "root._check_http_auth", "header": "['module', '___EOS___']", "index": 79 }, { "content": "def http_auth_required(realm):\n \"\"\"Decorator that protects endpoints using Basic HTTP authentication.\n The username should be set to the user's email address.\n\n :param realm: optional realm name\"\"\"\n\n def decorator(fn):\n @wraps(fn)\n def wrapper(*args, **kwargs):\n if _check_http_auth():\n return fn(*args, **kwargs)\n if _security._unauthorized_callback:\n return _security._unauthorized_callback()\n else:\n r = _security.default_http_auth_realm if callable(realm) else realm\n h = {'WWW-Authenticate': 'Basic realm=\"%s\"' % r}\n return _get_unauthorized_response(headers=h)\n return wrapper\n\n if callable(realm):\n return decorator(realm)\n return decorator", "metadata": "root.http_auth_required", "header": "['module', '___EOS___']", "index": 93 }, { "content": "def auth_token_required(fn):\n \"\"\"Decorator that protects endpoints using token authentication. The token\n should be added to the request by the client by using a query string\n variable with a name equal to the configuration value of\n `SECURITY_TOKEN_AUTHENTICATION_KEY` or in a request header named that of\n the configuration value of `SECURITY_TOKEN_AUTHENTICATION_HEADER`\n \"\"\"\n\n @wraps(fn)\n def decorated(*args, **kwargs):\n if _check_token():\n return fn(*args, **kwargs)\n if _security._unauthorized_callback:\n return _security._unauthorized_callback()\n else:\n return _get_unauthorized_response()\n return decorated", "metadata": "root.auth_token_required", "header": "['module', '___EOS___']", "index": 117 }, { "content": "def auth_required(*auth_methods):\n \"\"\"\n Decorator that protects enpoints through multiple mechanisms\n Example::\n\n @app.route('/dashboard')\n @auth_required('token', 'session')\n def dashboard():\n return 'Dashboard'\n\n :param auth_methods: Specified mechanisms.\n \"\"\"\n login_mechanisms = {\n 'token': lambda: _check_token(),\n 'basic': lambda: _check_http_auth(),\n 'session': lambda: current_user.is_authenticated\n }\n\n def wrapper(fn):\n @wraps(fn)\n def decorated_view(*args, **kwargs):\n h = {}\n mechanisms = [(method, login_mechanisms.get(method)) for method in auth_methods]\n for method, mechanism in mechanisms:\n if mechanism and mechanism():\n return fn(*args, **kwargs)\n elif method == 'basic':\n r = _security.default_http_auth_realm\n h['WWW-Authenticate'] = 'Basic realm=\"%s\"' % r\n if _security._unauthorized_callback:\n return _security._unauthorized_callback()\n else:\n return _get_unauthorized_response(headers=h)\n return decorated_view\n return wrapper", "metadata": "root.auth_required", "header": "['module', '___EOS___']", "index": 136 }, { "content": "def roles_required(*roles):\n \"\"\"Decorator which specifies that a user must have all the specified roles.\n Example::\n\n @app.route('/dashboard')\n @roles_required('admin', 'editor')\n def dashboard():\n return 'Dashboard'\n\n The current user must have both the `admin` role and `editor` role in order\n to view the page.\n\n :param args: The required roles.\n \"\"\"\n def wrapper(fn):\n @wraps(fn)\n def decorated_view(*args, **kwargs):\n perms = [Permission(RoleNeed(role)) for role in roles]\n for perm in perms:\n if not perm.can():\n if _security._unauthorized_callback:\n return _security._unauthorized_callback()\n else:\n return _get_unauthorized_view()\n return fn(*args, **kwargs)\n return decorated_view\n return wrapper", "metadata": "root.roles_required", "header": "['module', '___EOS___']", "index": 173 }, { "content": "def roles_accepted(*roles):\n \"\"\"Decorator which specifies that a user must have at least one of the\n specified roles. Example::\n\n @app.route('/create_post')\n @roles_accepted('editor', 'author')\n def create_post():\n return 'Create Post'\n\n The current user must have either the `editor` role or `author` role in\n order to view the page.\n\n :param args: The possible roles.\n \"\"\"\n def wrapper(fn):\n @wraps(fn)\n def decorated_view(*args, **kwargs):\n perm = Permission(*[RoleNeed(role) for role in roles])\n if perm.can():\n return fn(*args, **kwargs)\n if _security._unauthorized_callback:\n return _security._unauthorized_callback()\n else:\n return _get_unauthorized_view()\n return decorated_view\n return wrapper", "metadata": "root.roles_accepted", "header": "['module', '___EOS___']", "index": 202 }, { "content": "def anonymous_user_required(f):\n @wraps(f)\n def wrapper(*args, **kwargs):\n if current_user.is_authenticated:\n return redirect(utils.get_url(_security.post_login_view))\n return f(*args, **kwargs)\n return wrapper", "metadata": "root.anonymous_user_required", "header": "['module', '___EOS___']", "index": 230 } ]
[ { "span": "from flask_login import current_user, login_required ", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 52 } ]
[]
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", ";", " ", " ", " ", " ", "fla", "sk", "\\u", "security", ".", "decorat", "ors", "\\", "10", ";", " ", " ", " ", " ", "~~~~~~~~~~~", "~~~~~~~~~~~", "~~~", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Fla", "sk", "-", "Secur", "it", "y", " ", "decorat", "ors", " ", "module", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "copyr", "ight", ":", " ", "(", "c", ")", " ", "2012", " ", "by", " ", "Matt", " ", "Wr", "ight", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "license", ":", " ", "MIT", ",", " ", "see", " ", "LICENSE", " ", "for", " ", "more", " ", "deta", "il", "s", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "collections_", "import_", "namedtuple_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "functools_", "import_", "wraps_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "flask_", "import_", "(_", "abort_", ",_", "current", "\\u", "app_", ",_", "Response_", ",_", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url", "\\u", "for_", ",_", "redirect_", ",_", "\\u", "request", "\\u", "ctx", "\\u", "stack_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fla", "sk", "\\u", "login_", "import_", "current", "\\u", "user_", ",_", "login", "\\u", "required_", "#", " ", "pragma", ":", " ", "no", " ", "flake", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fla", "sk", "\\u", "principal_", "import_", "Ro", "le", "Ne", "ed_", ",_", "Permission_", ",_", "Identity_", ",_", "identi", "ty", "\\u", "changed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "werkzeug_", "._", "local_", "import_", "Local", "Proxy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "werkzeug_", "._", "routing_", "import_", "Build", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "import_", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Conve", "nie", "nt", " ", "references_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "security_", "=_", "Local", "Proxy_", "(_", "lambda_", ":_", "current", "\\u", "app_", "._", "extensions_", "[_", "'", "security", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "default", "\\u", "unauthorized", "\\u", "html_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "<", "h1", ">", "Una", "uthor", "ize", "d", "</", "h1", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "p", ">", "The", " ", "server", " ", "coul", "d", " ", "not", " ", "verify", " ", "tha", "t", " ", "you", " ", "are", " ", "authoriz", "ed", " ", "to", " ", "access", " ", "the", " ", "URL", "\\", "10", ";", " ", " ", " ", " ", "request", "ed", ".", " ", "You", " ", "eit", "her", " ", "supplie", "d", " ", "the", " ", "wrong", " ", "cred", "ential", "s", " ", "(", "e", ".", "g", ".", " ", "a", " ", "bad", " ", "password", "),", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "your", " ", "browse", "r", " ", "doe", "sn", "'", "t", " ", "underst", "and", " ", "how", " ", "to", " ", "supply", " ", "the", " ", "cred", "ential", "s", " ", "require", "d", ".", "</", "p", ">", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Basic", "Auth_", "=_", "namedtuple_", "(_", "'", "Basic", "Auth", "'_", ",_", "'", "user", "name", ",", " ", "password", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "get", "\\u", "unauthorized", "\\u", "response_", "(_", "text_", "=_", "None_", ",_", "headers_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "=_", "text_", "or_", "\\u", "default", "\\u", "unauthorized", "\\u", "html_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "headers_", "or_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Response_", "(_", "text_", ",_", "401_", ",_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "unauthorized", "\\u", "view_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "view_", "=_", "utils_", "._", "get", "\\u", "url_", "(_", "utils_", "._", "config", "\\u", "value_", "(_", "'", "UNA", "UTH", "ORI", "ZED", "\\u", "VIEW", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "view_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "callable_", "(_", "view_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "view_", "=_", "view_", "(_", ")_", "\\u\\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 ", " _", "view_", "=_", "url", "\\u", "for_", "(_", "view_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Build", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "view_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "utils_", "._", "do", "\\u", "flash_", "(_", "*_", "utils_", "._", "get", "\\u", "message_", "(_", "'", "UNA", "UTH", "ORI", "ZED", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "redirect_", "(_", "view_", "or_", "request_", "._", "referrer", "_", "or_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "abort_", "(_", "403_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "check", "\\u", "token_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "header", "\\u", "key_", "=_", "\\u", "security_", "._", "token", "\\u", "authenticat", "ion", "\\u", "header_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args", "\\u", "key_", "=_", "\\u", "security_", "._", "token", "\\u", "authenticat", "ion", "\\u", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "header", "\\u", "token_", "=_", "request_", "._", "headers_", "._", "get_", "(_", "header", "\\u", "key_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "token_", "=_", "request_", "._", "args_", "._", "get_", "(_", "args", "\\u", "key_", ",_", "header", "\\u", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "get", "\\u", "json_", "(_", "silent_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "request_", "._", "json_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "token_", "=_", "request_", "._", "json_", "._", "get_", "(_", "args", "\\u", "key_", ",_", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "user_", "=_", "\\u", "security_", "._", "login", "\\u", "manager_", "._", "token", "\\u", "callback_", "(_", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "user_", "and_", "user_", "._", "is", "\\u", "authenticated_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "=_", "current", "\\u", "app_", "._", "\\u", "get", "\\u", "current", "\\u", "object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "request", "\\u", "ctx", "\\u", "stack_", "._", "top_", "._", "user_", "=_", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "identi", "ty", "\\u", "changed_", "._", "send_", "(_", "app_", ",_", "identity_", "=_", "Identity_", "(_", "user_", "._", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "check", "\\u", "http", "\\u", "auth_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "auth_", "=_", "request_", "._", "authorization_", "or_", "Basic", "Auth_", "(_", "username_", "=_", "None_", ",_", "password_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "=_", "\\u", "security_", "._", "datastore_", "._", "find", "\\u", "user_", "(_", "email_", "=_", "auth_", "._", "username_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "user_", "and_", "utils_", "._", "verify", "\\u", "and", "\\u", "update", "\\u", "password_", "(_", "auth_", "._", "password_", ",_", "user_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "security_", "._", "datastore_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "=_", "current", "\\u", "app_", "._", "\\u", "get", "\\u", "current", "\\u", "object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "request", "\\u", "ctx", "\\u", "stack_", "._", "top_", "._", "user_", "=_", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "identi", "ty", "\\u", "changed_", "._", "send_", "(_", "app_", ",_", "identity_", "=_", "Identity_", "(_", "user_", "._", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "http", "\\u", "auth", "\\u", "required_", "(_", "realm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Decorat", "or", " ", "tha", "t", " ", "protect", "s", " ", "endpoint", "s", " ", "usi", "ng", " ", "Basic", " ", "HTTP", " ", "authenticat", "ion", ".", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "user", "name", " ", "shou", "ld", " ", "be", " ", "set", " ", "to", " ", "the", " ", "user", "'", "s", " ", "email", " ", "address", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "real", "m", ":", " ", "option", "al", " ", "real", "m", " ", "name", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "decorator_", "(_", "fn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "wraps_", "(_", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "wrapper_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u", "check", "\\u", "http", "\\u", "auth_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "fn_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "security_", "._", "\\u", "unauthorized", "\\u", "callback_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "security_", "._", "\\u", "unauthorized", "\\u", "callback_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "=_", "\\u", "security_", "._", "default", "\\u", "http", "\\u", "auth", "\\u", "realm_", "if_", "callable_", "(_", "realm_", ")_", "else_", "realm_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "=_", "{_", "'", "WW", "W", "-", "Auth", "entica", "te", "'_", ":_", "'", "Basic", " ", "real", "m", "=\"", "%", "s", "\"'_", "%_", "r_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u", "get", "\\u", "unauthorized", "\\u", "response_", "(_", "headers_", "=_", "h_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "wrapper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "callable_", "(_", "realm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "decorator_", "(_", "realm_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "decorator_", "\\u\\u\\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_", "auth", "\\u", "token", "\\u", "required_", "(_", "fn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Decorat", "or", " ", "tha", "t", " ", "protect", "s", " ", "endpoint", "s", " ", "usi", "ng", " ", "token", " ", "authenticat", "ion", ".", " ", "The", " ", "token", "\\", "10", ";", " ", " ", " ", " ", "shou", "ld", " ", "be", " ", "adde", "d", " ", "to", " ", "the", " ", "request", " ", "by", " ", "the", " ", "client", " ", "by", " ", "usi", "ng", " ", "a", " ", "query", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "variab", "le", " ", "with", " ", "a", " ", "name", " ", "equal", " ", "to", " ", "the", " ", "configura", "tion", " ", "value", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "`", "SECURITY", "\\u", "TOKEN", "\\u", "AUTHENTICATION", "\\u", "KEY", "`", " ", "or", " ", "in", " ", "a", " ", "request", " ", "header", " ", "named", " ", "tha", "t", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "configura", "tion", " ", "value", " ", "of", " ", "`", "SECURITY", "\\u", "TOKEN", "\\u", "AUTHENTICATION", "\\u", "HEAD", "ER", "`", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "wraps_", "(_", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "decorated_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u", "check", "\\u", "token_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "fn_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "security_", "._", "\\u", "unauthorized", "\\u", "callback_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "security_", "._", "\\u", "unauthorized", "\\u", "callback_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "get", "\\u", "unauthorized", "\\u", "response_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "decorated_", "\\u\\u\\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_", "auth", "\\u", "required_", "(_", "*_", "auth", "\\u", "methods_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Decorat", "or", " ", "tha", "t", " ", "protect", "s", " ", "en", "points", " ", "through", " ", "multiple", " ", "mechanism", "s", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ple", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "app", ".", "route", "('", "/", "dash", "board", "')", "\\", "10", ";", " ", " ", " ", " ", "@", "auth", "\\u", "require", "d", "('", "token", "',", " ", "'", "session", "')", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "dash", "board", "():", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "'", "Dash", "board", "'", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "auth", "\\u", "method", "s", ":", " ", "Specifie", "d", " ", "mechanism", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "login", "\\u", "mechanism", "s_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "token", "'_", ":_", "lambda_", ":_", "\\u", "check", "\\u", "token_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "basic", "'_", ":_", "lambda_", ":_", "\\u", "check", "\\u", "http", "\\u", "auth_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "session", "'_", ":_", "lambda_", ":_", "current", "\\u", "user_", "._", "is", "\\u", "authenticated_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "wrapper_", "(_", "fn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "wraps_", "(_", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "decorated", "\\u", "view_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "h_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mechanism", "s_", "=_", "[_", "(_", "method_", ",_", "login", "\\u", "mechanism", "s_", "._", "get_", "(_", "method_", ")_", ")_", "for_", "method_", "in_", "auth", "\\u", "methods_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "method_", ",_", "mechanism", "_", "in_", "mechanism", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "mechanism", "_", "and_", "mechanism", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "fn_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "method_", "==_", "'", "basic", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "r_", "=_", "\\u", "security_", "._", "default", "\\u", "http", "\\u", "auth", "\\u", "realm_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "[_", "'", "WW", "W", "-", "Auth", "entica", "te", "'_", "]_", "=_", "'", "Basic", " ", "real", "m", "=\"", "%", "s", "\"'_", "%_", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "security_", "._", "\\u", "unauthorized", "\\u", "callback_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "security_", "._", "\\u", "unauthorized", "\\u", "callback_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "get", "\\u", "unauthorized", "\\u", "response_", "(_", "headers_", "=_", "h_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "decorated", "\\u", "view_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "wrapper_", "\\u\\u\\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_", "role", "s", "\\u", "required_", "(_", "*_", "roles_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Decorat", "or", " ", "whi", "ch", " ", "speci", "fie", "s", " ", "tha", "t", " ", "a", " ", "user", " ", "must", " ", "have", " ", "all", " ", "the", " ", "specified", " ", "role", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ple", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "app", ".", "route", "('", "/", "dash", "board", "')", "\\", "10", ";", " ", " ", " ", " ", "@", "role", "s", "\\u", "require", "d", "('", "admin", "',", " ", "'", "editor", "')", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "dash", "board", "():", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "'", "Dash", "board", "'", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "current", " ", "user", " ", "must", " ", "have", " ", "bot", "h", " ", "the", " ", "`", "admin", "`", " ", "role", " ", "and", " ", "`", "editor", "`", " ", "role", " ", "in", " ", "order", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "view", " ", "the", " ", "page", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "args", ":", " ", "The", " ", "require", "d", " ", "role", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "wrapper_", "(_", "fn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "wraps_", "(_", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "decorated", "\\u", "view_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "perms_", "=_", "[_", "Permission_", "(_", "Ro", "le", "Ne", "ed_", "(_", "role_", ")_", ")_", "for_", "role_", "in_", "roles_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "perm_", "in_", "perms_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "perm_", "._", "can_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "\\u", "security_", "._", "\\u", "unauthorized", "\\u", "callback_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "return_", "\\u", "security_", "._", "\\u", "unauthorized", "\\u", "callback_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "return_", "\\u", "get", "\\u", "unauthorized", "\\u", "view_", "(_", ")_", "\\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_", "fn_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "decorated", "\\u", "view_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "wrapper_", "\\u\\u\\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_", "role", "s", "\\u", "accepted_", "(_", "*_", "roles_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Decorat", "or", " ", "whi", "ch", " ", "speci", "fie", "s", " ", "tha", "t", " ", "a", " ", "user", " ", "must", " ", "have", " ", "at", " ", "leas", "t", " ", "one", " ", "of", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "specified", " ", "role", "s", ".", " ", "Exam", "ple", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "app", ".", "route", "('", "/", "create", "\\u", "post", "')", "\\", "10", ";", " ", " ", " ", " ", "@", "role", "s", "\\u", "accept", "ed", "('", "editor", "',", " ", "'", "author", "')", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "create", "\\u", "post", "():", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "'", "Creat", "e", " ", "Post", "'", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "current", " ", "user", " ", "must", " ", "have", " ", "eit", "her", " ", "the", " ", "`", "editor", "`", " ", "role", " ", "or", " ", "`", "author", "`", " ", "role", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "order", " ", "to", " ", "view", " ", "the", " ", "page", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "args", ":", " ", "The", " ", "possib", "le", " ", "role", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "wrapper_", "(_", "fn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "wraps_", "(_", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "decorated", "\\u", "view_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "perm_", "=_", "Permission_", "(_", "*_", "[_", "Ro", "le", "Ne", "ed_", "(_", "role_", ")_", "for_", "role_", "in_", "roles_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "perm_", "._", "can_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "fn_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "security_", "._", "\\u", "unauthorized", "\\u", "callback_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "security_", "._", "\\u", "unauthorized", "\\u", "callback_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "get", "\\u", "unauthorized", "\\u", "view_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "decorated", "\\u", "view_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "wrapper_", "\\u\\u\\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_", "anonym", "ous", "\\u", "user", "\\u", "required_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "wraps_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "wrapper_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "current", "\\u", "user_", "._", "is", "\\u", "authenticated_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "redirect_", "(_", "utils_", "._", "get", "\\u", "url_", "(_", "\\u", "security_", "._", "post", "\\u", "login", "\\u", "view_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "f_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "wrapper_" ]
[ 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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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Module is imported with 'import' and 'import from'
statsmodels/statsmodels/statsmodels/compat/python.py
[ { "content": "\"\"\"\nCompatibility tools for differences between Python 2 and 3\n\"\"\"\nimport functools\nimport itertools\nimport sys\nimport urllib\n\nPY3 = (sys.version_info[0] >= 3)\nPY3_2 = sys.version_info[:2] == (3, 2)\n\nif PY3:\n import builtins\n from io import StringIO, BytesIO\n\n cStringIO = StringIO\n import pickle as cPickle\n pickle = cPickle\n import urllib.request\n import urllib.parse\n from urllib.request import HTTPError, urlretrieve, URLError\n import io\n bytes = bytes\n str = str\n asunicode = lambda x, _ : str(x)\n\n\n\n\n\n\n strchar = 'U'\n\n # have to explicitly put builtins into the namespace\n range = range\n map = map\n zip = zip\n filter = filter\n reduce = functools.reduce\n long = int\n unichr = chr\n zip_longest = itertools.zip_longest\n\n # list-producing versions of the major Python iterating functions\n\n\n\n\n urlopen = urllib.request.urlopen\n urljoin = urllib.parse.urljoin\n urlretrieve = urllib.request.urlretrieve\n urlencode = urllib.parse.urlencode\n string_types = str\n input = input\n\nelse:\n import __builtin__ as builtins\n # not writeable when instantiated with string, doesn't handle unicode well\n from cStringIO import StringIO as cStringIO\n # always writeable\n from StringIO import StringIO\n\n BytesIO = StringIO\n import cPickle\n pickle = cPickle\n import urllib2\n import urlparse\n\n bytes = str\n str = str\n asbytes = str\n asstr = str\n asstr2 = str\n strchar = 'S'\n\n\n\n\n # import iterator versions of these functions\n range = xrange\n zip = itertools.izip\n filter = itertools.ifilter\n map = itertools.imap\n reduce = reduce\n long = long\n unichr = unichr\n zip_longest = itertools.izip_longest\n\n # Python 2-builtin ranges produce lists\n lrange = builtins.range\n lzip = builtins.zip\n lmap = builtins.map\n lfilter = builtins.filter\n\n urlopen = urllib2.urlopen\n urljoin = urlparse.urljoin\n urlencode = urllib.urlencode\n HTTPError = urllib2.HTTPError\n URLError = urllib2.URLError\n string_types = basestring\n\n input = raw_input\n\n\n\n\n\n\n\n\ntry:\n advance_iterator = next\nexcept NameError:\nnext = advance_iterator\n\n\ntry:\n callable = callable\nexcept NameError:\n\n\n\n\n\n\n\n\n\ntry:\n combinations = itertools.combinations\nexcept:\n # Python 2.6 only\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import urllib.request", "start_line": 18, "start_column": 4, "end_line": 18, "end_column": 25 }, { "span": "import io", "start_line": 21, "start_column": 4, "end_line": 21, "end_column": 13 } ]
[]
1
true
[ "[CLS]_", "Module_", "is_", "imported_", "with_", "'", "import", "'_", "and_", "'", "import", " ", "from", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Compat", "ibi", "lit", "y", " ", "tool", "s", " ", "for", " ", "difference", "s", " ", "bet", "ween", " ", "Pyth", "on", " ", "2", " ", "and", " ", "3", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "functools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "itertools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "PY", "3_", "=_", "(_", "sys_", "._", "version", "\\u", "info_", "[_", "0_", "]_", ">=_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PY", "3", "\\u", "2_", "=_", "sys_", "._", "version", "\\u", "info_", "[_", ":_", "2_", "]_", "==_", "(_", "3_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "PY", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "builtins_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "io_", "import_", "String", "IO_", ",_", "Byte", "s", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c", "String", "IO_", "=_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pickle_", "as_", "c", "Pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pickle_", "=_", "c", "Pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib_", "._", "request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib_", "._", "parse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urllib_", "._", "request_", "import_", "HTTP", "Error_", ",_", "urlretrieve_", ",_", "URL", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "io_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bytes_", "=_", "bytes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "str_", "=_", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "asu", "nico", "de_", "=_", "lambda_", "x_", ",_", "\\u_", ":_", "str_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "strc", "har_", "=_", "'", "U", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "have", " ", "to", " ", "explicit", "ly", " ", "put", " ", "bui", "lti", "ns", " ", "int", "o", " ", "the", " ", "namespace_", "\\u\\u\\uNL\\u\\u\\u_", "range_", "=_", "range_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "map_", "=_", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zip_", "=_", "zip_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filter_", "=_", "filter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reduce_", "=_", "functools_", "._", "reduce_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "long_", "=_", "int_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unichr_", "=_", "chr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zip", "\\u", "longest_", "=_", "itertools_", "._", "zip", "\\u", "longest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "list", "-", "produc", "ing", " ", "version", "s", " ", "of", " ", "the", " ", "major", " ", "Pyth", "on", " ", "iterati", "ng", " ", "functions_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "urlopen_", "=_", "urllib_", "._", "request_", "._", "urlopen_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "urljoin_", "=_", "urllib_", "._", "parse_", "._", "urljoin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "urlretrieve_", "=_", "urllib_", "._", "request_", "._", "urlretrieve_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "urlencode_", "=_", "urllib_", "._", "parse_", "._", "urlencode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "string", "\\u", "types_", "=_", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input_", "=_", "input_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "\\u\\u", "builtin\\u\\u_", "as_", "builtins_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "not", " ", "writea", "ble", " ", "whe", "n", " ", "instantiate", "d", " ", "with", " ", "string", ",", " ", "doe", "sn", "'", "t", " ", "handle", " ", "unicode", " ", "well_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "c", "String", "IO_", "import_", "String", "IO_", "as_", "c", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "alw", "ay", "s", " ", "writea", "ble_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "String", "IO_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Byte", "s", "IO_", "=_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "c", "Pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pickle_", "=_", "c", "Pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urlparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "bytes_", "=_", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "str_", "=_", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "as", "bytes_", "=_", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ass", "tr_", "=_", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ass", "tr", "2_", "=_", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "strc", "har_", "=_", "'", "S", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "import", " ", "iter", "ator", " ", "version", "s", " ", "of", " ", "these", " ", "functions_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "range_", "=_", "xrange_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zip_", "=_", "itertools_", "._", "izip_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filter_", "=_", "itertools_", "._", "ifi", "lter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "map_", "=_", "itertools_", "._", "imap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reduce_", "=_", "reduce_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "long_", "=_", "long_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unichr_", "=_", "unichr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zip", "\\u", "longest_", "=_", "itertools_", "._", "izi", "p", "\\u", "longest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pyth", "on", " ", "2", "-", "bui", "lti", "n", " ", "ranges", " ", "produce", " ", "lists_", "\\u\\u\\uNL\\u\\u\\u_", "lra", "nge_", "=_", "builtins_", "._", "range_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lz", "ip_", "=_", "builtins_", "._", "zip_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lma", "p_", "=_", "builtins_", "._", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lfil", "ter_", "=_", "builtins_", "._", "filter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "urlopen_", "=_", "urllib2_", "._", "urlopen_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "urljoin_", "=_", "urlparse_", "._", "urljoin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "urlencode_", "=_", "urllib_", "._", "urlencode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "HTTP", "Error_", "=_", "urllib2_", "._", "HTTP", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "URL", "Error_", "=_", "urllib2_", "._", "URL", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "string", "\\u", "types_", "=_", "basestring_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "input_", "=_", "raw", "\\u", "input_", "\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "advance", "\\u", "iterator_", "=_", "next_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Name", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "next_", "=_", "advance", "\\u", "iterator_", "\\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 ", " _", "callable_", "=_", "callable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Name", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "combinations_", "=_", "itertools_", "._", "combinations_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pyth", "on", " ", "2.6", " ", "only_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
django-leonardo/django-leonardo/leonardo/module/leonardo_auth/forms.py
[ { "content": "from __future__ import absolute_import\n\nfrom django.contrib.auth import authenticate, login\nfrom django.contrib.auth.models import User\nfrom django.contrib.auth.tokens import default_token_generator\nfrom django.contrib.sites.models import Site\nfrom django.core import exceptions\nfrom django.core.urlresolvers import reverse\nfrom django.db.models import Q\nfrom django.utils.translation import ugettext_lazy as _\nfrom django.utils.translation import pgettext, ugettext\nfrom horizon import forms, messages\nfrom leonardo.forms import SelfHandlingForm, Layout, InlineCheckboxes\nfrom horizon.utils import validators\n\n\n\n\n\n\n\"\"\"\nclass ChangePasswordForm(UserForm):\n\n oldpassword = PasswordField(label=_(\"Current Password\"))\n password1 = SetPasswordField(label=_(\"New Password\"))\n password2 = PasswordField(label=_(\"New Password (again)\"))\n\n def clean_oldpassword(self):\n if not self.user.check_password(self.cleaned_data.get(\"oldpassword\")):\n raise forms.ValidationError(_(\"Please type your current\"\n \" password.\"))\n return self.cleaned_data[\"oldpassword\"]\n\n def clean_password2(self):\n if (\"password1\" in self.cleaned_data\n and \"password2\" in self.cleaned_data):\n if (self.cleaned_data[\"password1\"]\n != self.cleaned_data[\"password2\"]):\n raise forms.ValidationError(_(\"You must type the same password\"\n \" each time.\"))\n return self.cleaned_data[\"password2\"]\n\n def save(self):\n get_adapter().set_password(self.user, self.cleaned_data[\"password1\"])\n\n\nclass SetPasswordForm(UserForm):\n\n password1 = SetPasswordField(label=_(\"Password\"))\n password2 = PasswordField(label=_(\"Password (again)\"))\n\n def clean_password2(self):\n if (\"password1\" in self.cleaned_data\n and \"password2\" in self.cleaned_data):\n if (self.cleaned_data[\"password1\"]\n != self.cleaned_data[\"password2\"]):\n raise forms.ValidationError(_(\"You must type the same password\"\n \" each time.\"))\n return self.cleaned_data[\"password2\"]\n\n def save(self):\n get_adapter().set_password(self.user, self.cleaned_data[\"password1\"])\n\n\nclass ResetPasswordForm(forms.Form):\n\n email = forms.EmailField(\n label=_(\"E-mail\"),\n required=True,\n widget=forms.TextInput(attrs={\"type\": \"email\", \"size\": \"30\"}))\n\n def clean_email(self):\n email = self.cleaned_data[\"email\"]\n email = get_adapter().clean_email(email)\n self.users = get_user_model().objects \\\n .filter(Q(email__iexact=email)\n | Q(emailaddress__email__iexact=email)).distinct()\n if not self.users.exists():\n raise forms.ValidationError(_(\"The e-mail address is not assigned\"\n \" to any user account\"))\n return self.cleaned_data[\"email\"]\n\n def save(self, request, **kwargs):\n\n email = self.cleaned_data[\"email\"]\n token_generator = kwargs.get(\"token_generator\",\n default_token_generator)\n\n for user in self.users:\n\n temp_key = token_generator.make_token(user)\n\n # save it to the password reset model\n # password_reset = PasswordReset(user=user, temp_key=temp_key)\n # password_reset.save()\n\n current_site = Site.objects.get_current()\n\n # send the password reset email\n path = reverse(\"account_reset_password_from_key\",\n kwargs=dict(uidb36=user_pk_to_url_str(user),\n key=temp_key))\n url = build_absolute_uri(request, path,\n protocol=app_settings.DEFAULT_HTTP_PROTOCOL)\n context = {\"site\": current_site,\n \"user\": user,\n \"password_reset_url\": url}\n if app_settings.AUTHENTICATION_METHOD \\\n != AuthenticationMethod.EMAIL:\n context['username'] = user_username(user)\n get_adapter().send_mail('account/email/password_reset_key',\n email,\n context)\n return self.cleaned_data[\"email\"]\n\n\nclass ResetPasswordKeyForm(forms.Form):\n\n password1 = SetPasswordField(label=_(\"New Password\"))\n password2 = PasswordField(label=_(\"New Password (again)\"))\n\n def __init__(self, *args, **kwargs):\n self.user = kwargs.pop(\"user\", None)\n self.temp_key = kwargs.pop(\"temp_key\", None)\n super(ResetPasswordKeyForm, self).__init__(*args, **kwargs)\n\n # FIXME: Inspecting other fields -> should be put in def clean(self) ?\n def clean_password2(self):\n if (\"password1\" in self.cleaned_data\n and \"password2\" in self.cleaned_data):\n if (self.cleaned_data[\"password1\"]\n != self.cleaned_data[\"password2\"]):\n raise forms.ValidationError(_(\"You must type the same\"\n \" password each time.\"))\n return self.cleaned_data[\"password2\"]\n\n def save(self):\n get_adapter().set_password(self.user, self.cleaned_data[\"password1\"])\n\"\"\"\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class LoginForm(SelfHandlingForm):\n\n username = forms.CharField(label=_(\"Username\"),\n max_length=255,\n widget=forms.TextInput(\n attrs={'placeholder':\n _('Username'),\n 'autofocus': 'autofocus'}))\n\n password = forms.CharField(label=_(\"Password\"),\n widget=forms.PasswordInput(render_value=False))\n remember = forms.BooleanField(label=_(\"Remember Me\"),\n required=False)\n\n", "metadata": "root.LoginForm", "header": "['module', '___EOS___']", "index": 16 }, { "content": " def __init__(self, *args, **kwargs):\n super(LoginForm, self).__init__(*args, **kwargs)\n self.helper.layout = Layout(\n 'username', 'password', 'remember',\n )", "metadata": "root.LoginForm.__init__", "header": "['class', 'LoginForm', '(', 'SelfHandlingForm', ')', ':', '___EOS___']", "index": 30 }, { "content": " def handle(self, request, data):\n\n user = authenticate(**data)\n if user is not None:\n if user.is_active:\n login(request, user)\n\n messages.success(request, \"Login success.\")\n return True\n messages.error(request, \"Login failed.\")\n return False", "metadata": "root.LoginForm.handle", "header": "['class', 'LoginForm', '(', 'SelfHandlingForm', ')', ':', '___EOS___']", "index": 36 }, { "content": "class SignupForm(SelfHandlingForm):\n\n username = forms.CharField(label=_(\"Username\"),\n max_length=255,\n widget=forms.TextInput(\n attrs={'placeholder':\n _('Username'),\n 'autofocus': 'autofocus'}))\n email = forms.EmailField(widget=forms.TextInput(\n attrs={'type': 'email',\n 'placeholder': _('E-mail address')}))\n\n password = forms.RegexField(\n label=_(\"Password\"),\n widget=forms.PasswordInput(render_value=False),\n regex=validators.password_validator(),\n error_messages={'invalid': validators.password_validator_msg()})\n confirm_password = forms.CharField(\n label=_(\"Confirm Password\"),\n widget=forms.PasswordInput(render_value=False))\n no_autocomplete = True\n\n", "metadata": "root.SignupForm", "header": "['module', '___EOS___']", "index": 49 }, { "content": " def clean(self):\n '''Check to make sure password fields match.'''\n data = super(forms.Form, self).clean()\n\n # basic check for now\n if 'username' in data:\n if User.objects.filter(\n username=data['username'],\n email=data['email']).exists():\n raise validators.ValidationError(\n _('Username or email exists in database.'))\n\n if 'password' in data:\n if data['password'] != data.get('confirm_password', None):\n raise validators.ValidationError(_('Passwords do not match.'))\n else:\n data.pop('confirm_password')\n return data", "metadata": "root.SignupForm.clean", "header": "['class', 'SignupForm', '(', 'SelfHandlingForm', ')', ':', '___EOS___']", "index": 71 }, { "content": " def handle(self, request, data):\n\n try:\n user = User.objects.create_user(**data)\n messages.success(\n request,\n _(\"User account {} was successfuly created.\".format(user)))\n\n except Exception as e:\n raise e\n else:\n data.pop('email')\n return LoginForm().handle(request, data)\n\n messages.error(request, _(\"Create Account failed.\"))\n return False", "metadata": "root.SignupForm.handle", "header": "['class', 'SignupForm', '(', 'SelfHandlingForm', ')', ':', '___EOS___']", "index": 90 } ]
[ { "span": "from django.contrib.auth.tokens import default_token_generator", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 62 }, { "span": "from django.contrib.sites.models import Site", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 44 }, { "span": "from django.core import exceptions", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 34 }, { "span": "from django.core.urlresolvers import reverse", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 44 }, { "span": "from django.db.models import Q", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 30 }, { "span": "from django.utils.translation import pgettext, ugettext", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 55 }, { "span": "from leonardo.forms import SelfHandlingForm, Layout, InlineCheckboxes", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 69 } ]
[]
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_", "._", "contrib_", "._", "auth_", "import_", "authenticate_", ",_", "login_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "models_", "import_", "User_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "tokens_", "import_", "default", "\\u", "token", "\\u", "generator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "sites_", "._", "models_", "import_", "Site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "import_", "exceptions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "urlresolvers_", "import_", "reverse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "._", "models_", "import_", "Q_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "translation_", "import_", "uge", "ttext", "\\u", "lazy_", "as_", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "translation_", "import_", "pge", "ttext", "_", ",_", "ugettext_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "horizon_", "import_", "forms_", ",_", "messages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "leo", "nar", "do_", "._", "forms_", "import_", "Self", "Hand", "ling", "Form_", ",_", "Layout_", ",_", "In", "line", "Checkb", "oxe", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "horizon_", "._", "utils_", "import_", "validators_", "\\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_", "\"\"\"", "\\", "10", ";", "class", " ", "Change", "Passw", "ord", "Form", "(", "User", "Form", "):", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "oldp", "ass", "word", " ", "=", " ", "Passw", "ord", "Field", "(", "label", "=", "\\u(", "\"", "Curr", "ent", " ", "Passw", "ord", "\"))", "\\", "10", ";", " ", " ", " ", " ", "password", "1", " ", "=", " ", "Set", "Passw", "ord", "Field", "(", "label", "=", "\\u(", "\"", "New", " ", "Passw", "ord", "\"))", "\\", "10", ";", " ", " ", " ", " ", "password", "2", " ", "=", " ", "Passw", "ord", "Field", "(", "label", "=", "\\u(", "\"", "New", " ", "Passw", "ord", " ", "(", "again", ")\"", "))\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "clean", "\\u", "oldp", "ass", "word", "(", "self", "):", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "not", " ", "self", ".", "user", ".", "check", "\\u", "password", "(", "self", ".", "clean", "ed", "\\u", "data", ".", "get", "(\"", "oldp", "ass", "word", "\"))", ":", "\\", "10", ";", " ", " ", " ", " ", "raise", " ", "forms", ".", "Validat", "ion", "Error", "(\\u", "(\"", "Ple", "ase", " ", "type", " ", "your", " ", "current", "\"", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "\"", " ", "password", ".\"", "))\\", "10", ";", " ", " ", " ", " ", "return", " ", "self", ".", "clean", "ed", "\\u", "data", "[\"", "oldp", "ass", "word", "\"]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "clean", "\\u", "password", "2", "(", "self", "):", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "(\"", "password", "1", "\"", " ", "in", " ", "self", ".", "clean", "ed", "\\u", "data", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "\"", "password", "2", "\"", " ", "in", " ", "self", ".", "clean", "ed", "\\u", "data", "):", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "(", "self", ".", "clean", "ed", "\\u", "data", "[\"", "password", "1", "\"]", "\\", "10", ";", " ", " ", "!=", " ", "self", ".", "clean", "ed", "\\u", "data", "[\"", "password", "2", "\"]", "):", "\\", "10", ";", " ", " ", " ", " ", "raise", " ", "forms", ".", "Validat", "ion", "Error", "(\\u", "(\"", "You", " ", "must", " ", "type", " ", "the", " ", "same", " ", "password", "\"", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "\"", " ", "each", " ", "time", ".\"", "))\\", "10", ";", " ", " ", " ", " ", "return", " ", "self", ".", "clean", "ed", "\\u", "data", "[\"", "password", "2", "\"]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "save", "(", "self", "):", "\\", "10", ";", " ", " ", " ", " ", "get", "\\u", "adapter", "()", ".", "set\\u", "password", "(", "self", ".", "user", ",", " ", "self", ".", "clean", "ed", "\\u", "data", "[\"", "password", "1", "\"]", ")", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", "class", " ", "Set", "Passw", "ord", "Form", "(", "User", "Form", "):", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "password", "1", " ", "=", " ", "Set", "Passw", "ord", "Field", "(", "label", "=", "\\u(", "\"", "Passw", "ord", "\"))", "\\", "10", ";", " ", " ", " ", " ", "password", "2", " ", "=", " ", "Passw", "ord", "Field", "(", "label", "=", "\\u(", "\"", "Passw", "ord", " ", "(", "again", ")\"", "))\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "clean", "\\u", "password", "2", "(", "self", "):", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "(\"", "password", "1", "\"", " ", "in", " ", "self", ".", "clean", "ed", "\\u", "data", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "\"", "password", "2", "\"", " ", "in", " ", "self", ".", "clean", "ed", "\\u", "data", "):", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "(", "self", ".", "clean", "ed", "\\u", "data", "[\"", "password", "1", "\"]", "\\", "10", ";", " ", " ", "!=", " ", "self", ".", "clean", "ed", "\\u", "data", "[\"", "password", "2", "\"]", "):", "\\", "10", ";", " ", " ", " ", " ", "raise", " ", "forms", ".", "Validat", "ion", "Error", "(\\u", "(\"", "You", " ", "must", " ", "type", " ", "the", " ", "same", " ", "password", "\"", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "\"", " ", "each", " ", "time", ".\"", "))\\", "10", ";", " ", " ", " ", " ", "return", " ", "self", ".", "clean", "ed", "\\u", "data", "[\"", "password", "2", "\"]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "save", "(", "self", "):", "\\", "10", ";", " ", " ", " ", " ", "get", "\\u", "adapter", "()", ".", "set\\u", "password", "(", "self", ".", "user", ",", " ", "self", ".", "clean", "ed", "\\u", "data", "[\"", "password", "1", "\"]", ")", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", "class", " ", "Reset", "Passw", "ord", "Form", "(", "forms", ".", "Form", "):", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "email", " ", "=", " ", "forms", ".", "Ema", "il", "Field", "(", "\\", "10", ";", " ", " ", " ", " ", "label", "=", "\\u(", "\"", "E-", "mail", "\")", ",", "\\", "10", ";", " ", " ", " ", " ", "require", "d", "=", "Tru", "e", ",", "\\", "10", ";", " ", " ", " ", " ", "widget", "=", "forms", ".", "Text", "Inp", "ut", "(", "attr", "s", "={", "\"", "type", "\":", " ", "\"", "email", "\",", " ", "\"", "size", "\":", " ", "\"", "30", "\"}", "))\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "clean", "\\u", "email", "(", "self", "):", "\\", "10", ";", " ", " ", " ", " ", "email", " ", "=", " ", "self", ".", "clean", "ed", "\\u", "data", "[\"", "email", "\"]", "\\", "10", ";", " ", " ", " ", " ", "email", " ", "=", " ", "get", "\\u", "adapter", "()", ".", "clean", "\\u", "email", "(", "email", ")", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "users", " ", "=", " ", "get", "\\u", "user", "\\u", "model", "()", ".", "object", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", ".", "filter", "(", "Q", "(", "email", "\\u\\u", "iex", "act", "=", "email", ")", "\\", "10", ";", " ", " ", "|", " ", "Q", "(", "email", "address", "\\u\\u", "email", "\\u\\u", "iex", "act", "=", "email", "))", ".", "distinct", "()", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "not", " ", "self", ".", "users", ".", "exist", "s", "():", "\\", "10", ";", " ", " ", " ", " ", "raise", " ", "forms", ".", "Validat", "ion", "Error", "(\\u", "(\"", "The", " ", "e-", "mail", " ", "address", " ", "is", " ", "not", " ", "assign", "ed", "\"", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "\"", " ", "to", " ", "any", " ", "user", " ", "account", "\"))", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "self", ".", "clean", "ed", "\\u", "data", "[\"", "email", "\"]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "save", "(", "self", ",", " ", "request", ",", " ", "**", "kwarg", "s", "):", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "email", " ", "=", " ", "self", ".", "clean", "ed", "\\u", "data", "[\"", "email", "\"]", "\\", "10", ";", " ", " ", " ", " ", "token", "\\u", "generat", "or", " ", "=", " ", "kwarg", "s", ".", "get", "(\"", "token", "\\u", "generat", "or", "\",", "\\", "10", ";", " ", " ", " ", " ", " ", " ", " ", "default", "\\u", "token", "\\u", "generat", "or", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "user", " ", "in", " ", "self", ".", "users", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "temp", "\\u", "key", " ", "=", " ", "token", "\\u", "generat", "or", ".", "make", "\\u", "token", "(", "user", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "save", " ", "it", " ", "to", " ", "the", " ", "password", " ", "reset", " ", "model", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "password", "\\u", "reset", " ", "=", " ", "Passw", "ord", "Reset", "(", "user", "=", "user", ",", " ", "temp", "\\u", "key", "=", "temp", "\\u", "key", ")", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "password", "\\u", "reset", ".", "save", "()", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "current", "\\u", "site", " ", "=", " ", "Site", ".", "object", "s", ".", "get", "\\u", "current", "()", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "send", " ", "the", " ", "password", " ", "reset", " ", "email", "\\", "10", ";", " ", " ", " ", " ", "path", " ", "=", " ", "reverse", "(\"", "account", "\\u", "reset", "\\u", "password", "\\u", "from", "\\u", "key", "\",", "\\", "10", ";", " ", " ", " ", " ", " ", "kwarg", "s", "=", "dict", "(", "uid", "b3", "6", "=", "user", "\\u", "pk", "\\u", "to", "\\u", "url", "\\u", "str", "(", "user", "),", "\\", "10", ";", " ", " ", " ", "key", "=", "temp", "\\u", "key", "))\\", "10", ";", " ", " ", " ", " ", "url", " ", "=", " ", "build", "\\u", "abs", "olute", "\\u", "uri", "(", "request", ",", " ", "path", ",", "\\", "10", ";", " ", " ", " ", " ", " ", " ", " ", "protoc", "ol", "=", "app", "\\u", "settings", ".", "DEF", "AUL", "T", "\\u", "HTTP", "\\u", "PROTOCOL", ")", "\\", "10", ";", " ", " ", " ", " ", "context", " ", "=", " ", "{", "\"", "site", "\":", " ", "current", "\\u", "site", ",", "\\", "10", ";", " ", " ", " ", " ", " ", "\"", "user", "\":", " ", "user", ",", "\\", "10", ";", " ", " ", " ", " ", " ", "\"", "password", "\\u", "reset", "\\u", "url", "\":", " ", "url", "}", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "app", "\\u", "settings", ".", "AUTHENTICATION", "\\u", "METH", "OD", " ", "\\\\", "\\", "10", ";", " ", " ", "!=", " ", "Auth", "entica", "tion", "Meth", "od", ".", "EMA", "IL", ":", "\\", "10", ";", " ", " ", " ", " ", "context", "['", "user", "name", "']", " ", "=", " ", "user", "\\u", "user", "name", "(", "user", ")", "\\", "10", ";", " ", " ", " ", " ", "get", "\\u", "adapter", "()", ".", "send", "\\u", "mail", "('", "account", "/", "email", "/", "password", "\\u", "reset", "\\u", "key", "',", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "email", ",", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "context", ")", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "self", ".", "clean", "ed", "\\u", "data", "[\"", "email", "\"]", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", "class", " ", "Reset", "Passw", "ord", "Key", "Form", "(", "forms", ".", "Form", "):", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "password", "1", " ", "=", " ", "Set", "Passw", "ord", "Field", "(", "label", "=", "\\u(", "\"", "New", " ", "Passw", "ord", "\"))", "\\", "10", ";", " ", " ", " ", " ", "password", "2", " ", "=", " ", "Passw", "ord", "Field", "(", "label", "=", "\\u(", "\"", "New", " ", "Passw", "ord", " ", "(", "again", ")\"", "))\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "\\u\\u", "init", "\\u\\u", "(", "self", ",", " ", "*", "args", ",", " ", "**", "kwarg", "s", "):", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "user", " ", "=", " ", "kwarg", "s", ".", "pop", "(\"", "user", "\",", " ", "Non", "e", ")", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "temp", "\\u", "key", " ", "=", " ", "kwarg", "s", ".", "pop", "(\"", "temp", "\\u", "key", "\",", " ", "Non", "e", ")", "\\", "10", ";", " ", " ", " ", " ", "super", "(", "Reset", "Passw", "ord", "Key", "Form", ",", " ", "self", ").", "\\u\\u", "init", "\\u\\u", "(*", "args", ",", " ", "**", "kwarg", "s", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "FIX", "ME", ":", " ", "Inspect", "ing", " ", "other", " ", "fields", " ", "->", " ", "shou", "ld", " ", "be", " ", "put", " ", "in", " ", "def", " ", "clean", "(", "self", ")", " ", "?", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "clean", "\\u", "password", "2", "(", "self", "):", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "(\"", "password", "1", "\"", " ", "in", " ", "self", ".", "clean", "ed", "\\u", "data", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "\"", "password", "2", "\"", " ", "in", " ", "self", ".", "clean", "ed", "\\u", "data", "):", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "(", "self", ".", "clean", "ed", "\\u", "data", "[\"", "password", "1", "\"]", "\\", "10", ";", " ", " ", "!=", " ", "self", ".", "clean", "ed", "\\u", "data", "[\"", "password", "2", "\"]", "):", "\\", "10", ";", " ", " ", " ", " ", "raise", " ", "forms", ".", "Validat", "ion", "Error", "(\\u", "(\"", "You", " ", "must", " ", "type", " ", "the", " ", "same", "\"", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "\"", " ", "password", " ", "each", " ", "time", ".\"", "))\\", "10", ";", " ", " ", " ", " ", "return", " ", "self", ".", "clean", "ed", "\\u", "data", "[\"", "password", "2", "\"]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "save", "(", "self", "):", "\\", "10", ";", " ", " ", " ", " ", "get", "\\u", "adapter", "()", ".", "set\\u", "password", "(", "self", ".", "user", ",", " ", "self", ".", "clean", "ed", "\\u", "data", "[\"", "password", "1", "\"]", ")", "\\", "10", ";\"\"\"_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Logi", "n", "Form_", "(_", "Self", "Hand", "ling", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "username_", "=_", "forms_", "._", "Char", "Field_", "(_", "label_", "=_", "\\u_", "(_", "\"", "User", "name", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "length_", "=_", "255_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "widget_", "=_", "forms_", "._", "Text", "Input_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "attrs_", "=_", "{_", "'", "placehold", "er", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "'", "User", "name", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "autof", "ocus", "'_", ":_", "'", "autof", "ocus", "'_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "password_", "=_", "forms_", "._", "Char", "Field_", "(_", "label_", "=_", "\\u_", "(_", "\"", "Passw", "ord", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "widget_", "=_", "forms_", "._", "Passw", "ord", "Input_", "(_", "render", "\\u", "value_", "=_", "False_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remember", "_", "=_", "forms_", "._", "Boo", "lean", "Field_", "(_", "label_", "=_", "\\u_", "(_", "\"", "Reme", "mber", " ", "Me", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Logi", "n", "Form_", "(_", "Self", "Hand", "ling", "Form_", ")_", ":_", "\\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 ", " _", "super_", "(_", "Logi", "n", "Form_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "helper_", "._", "layout_", "=_", "Layout_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "name", "'_", ",_", "'", "password", "'_", ",_", "'", "remember", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Logi", "n", "Form_", "(_", "Self", "Hand", "ling", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "handle_", "(_", "self_", ",_", "request_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", "=_", "authenticate_", "(_", "**_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "user_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "user_", "._", "is", "\\u", "active_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "login_", "(_", "request_", ",_", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "messages_", "._", "success_", "(_", "request_", ",_", "\"", "Logi", "n", " ", "success", ".\"_", ")_", "\\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_", "messages_", "._", "error_", "(_", "request_", ",_", "\"", "Logi", "n", " ", "fail", "ed", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Sign", "up", "Form_", "(_", "Self", "Hand", "ling", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "username_", "=_", "forms_", "._", "Char", "Field_", "(_", "label_", "=_", "\\u_", "(_", "\"", "User", "name", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "length_", "=_", "255_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "widget_", "=_", "forms_", "._", "Text", "Input_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "attrs_", "=_", "{_", "'", "placehold", "er", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "'", "User", "name", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "autof", "ocus", "'_", ":_", "'", "autof", "ocus", "'_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "email_", "=_", "forms_", "._", "Ema", "il", "Field_", "(_", "widget_", "=_", "forms_", "._", "Text", "Input_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "attrs_", "=_", "{_", "'", "type", "'_", ":_", "'", "email", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "placehold", "er", "'_", ":_", "\\u_", "(_", "'", "E-", "mail", " ", "address", "'_", ")_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "password_", "=_", "forms_", "._", "Rege", "x", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "\\u_", "(_", "\"", "Passw", "ord", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "widget_", "=_", "forms_", "._", "Passw", "ord", "Input_", "(_", "render", "\\u", "value_", "=_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "regex_", "=_", "validators_", "._", "password", "\\u", "validator_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "error", "\\u", "messages_", "=_", "{_", "'", "invalid", "'_", ":_", "validators_", "._", "password", "\\u", "validator", "\\u", "msg_", "(_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "confirm", "\\u", "password_", "=_", "forms_", "._", "Char", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "\\u_", "(_", "\"", "Confirm", " ", "Passw", "ord", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "widget_", "=_", "forms_", "._", "Passw", "ord", "Input_", "(_", "render", "\\u", "value_", "=_", "False_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "no", "\\u", "autocomplete", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Sign", "up", "Form_", "(_", "Self", "Hand", "ling", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "clean_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Check", " ", "to", " ", "make", " ", "sure", " ", "password", " ", "fields", " ", "match", ".'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "super_", "(_", "forms_", "._", "Form_", ",_", "self_", ")_", "._", "clean_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "basic", " ", "check", " ", "for", " ", "now_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "user", "name", "'_", "in_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "User_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "username_", "=_", "data_", "[_", "'", "user", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "email_", "=_", "data_", "[_", "'", "email", "'_", "]_", ")_", "._", "exists_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "validators_", "._", "Validat", "ion", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "'", "User", "name", " ", "or", " ", "email", " ", "exist", "s", " ", "in", " ", "databa", "se", ".'_", ")_", ")_", "\\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_", "'", "password", "'_", "in_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "data_", "[_", "'", "password", "'_", "]_", "!=_", "data_", "._", "get_", "(_", "'", "confirm", "\\u", "password", "'_", ",_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "validators_", "._", "Validat", "ion", "Error_", "(_", "\\u_", "(_", "'", "Passw", "ords", " ", "do", " ", "not", " ", "match", ".'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "._", "pop_", "(_", "'", "confirm", "\\u", "password", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sign", "up", "Form_", "(_", "Self", "Hand", "ling", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "handle_", "(_", "self_", ",_", "request_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", "=_", "User_", "._", "objects_", "._", "create", "\\u", "user_", "(_", "**_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "messages_", "._", "success_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "User", " ", "account", " ", "{}", " ", "was", " ", "success", "ful", "y", " ", "created", ".\"_", "._", "format_", "(_", "user_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "._", "pop_", "(_", "'", "email", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Logi", "n", "Form_", "(_", ")_", "._", "handle_", "(_", "request_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "messages_", "._", "error_", "(_", "request_", ",_", "\\u_", "(_", "\"", "Creat", "e", " ", "Account", " ", "fail", "ed", ".\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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 ]
Variable defined multiple times
rizar/attention-lvcsr/libs/Theano/theano/tensor/nnet/tests/test_neighbours.py
[ { "content": " def test_infer_shape(self):\n shape = (100, 40, 6, 3)\n images = numpy.ones(shape).astype('float32')\n x = T.ftensor4()\n f = self._compile_and_check([x],\n [images2neibs(\n x, neib_shape=(2, 1),\n mode='valid')],\n [images],\n Images2Neibs\n )\n f = self._compile_and_check([x],\n [images2neibs(\n x, neib_shape=(2, 3),\n mode='valid')],\n [images],\n Images2Neibs\n )\n shape = (100, 40, 5, 4)\n images = numpy.ones(shape).astype('float32')\n x = T.ftensor4()\n f = self._compile_and_check([x],\n [images2neibs(\n x, neib_shape=(2, 1),\n mode='ignore_borders')],\n [images],\n Images2Neibs\n )\n shape = (100, 40, 5, 3)\n images = numpy.ones(shape).astype('float32')\n x = T.ftensor4()\n f = self._compile_and_check([x],\n [images2neibs(\n x, neib_shape=(2, 3),\n mode='ignore_borders')],\n [images],\n Images2Neibs\n )\n\n shape = (100, 40, 6, 7)\n images = numpy.ones(shape).astype('float32')\n x = T.ftensor4()\n f = self._compile_and_check([x],\n [images2neibs(\n x, neib_shape=(2, 2),\n mode='ignore_borders')],\n [images],\n Images2Neibs\n )\n shape = (100, 40, 5, 10)\n images = numpy.ones(shape).astype('float32')\n x = T.ftensor4()\n f = self._compile_and_check([x],\n [images2neibs(\n x, neib_shape=(3, 3),\n mode='wrap_centered')],\n [images],\n Images2Neibs\n )", "metadata": "root.T_Images2Neibs.test_infer_shape", "header": "['class', 'T_Images2Neibs', '(', 'unittest_tools', '.', 'InferShapeTester', ')', ':', '___EOS___']", "index": 372 } ]
[ { "span": "f ", "start_line": 376, "start_column": 8, "end_line": 376, "end_column": 9 }, { "span": "f ", "start_line": 383, "start_column": 8, "end_line": 383, "end_column": 9 }, { "span": "f ", "start_line": 393, "start_column": 8, "end_line": 393, "end_column": 9 }, { "span": "f ", "start_line": 403, "start_column": 8, "end_line": 403, "end_column": 9 }, { "span": "f ", "start_line": 414, "start_column": 8, "end_line": 414, "end_column": 9 } ]
[]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "T", "\\u", "Image", "s2", "Nei", "bs_", "(_", "unittest", "\\u", "tools_", "._", "Infer", "Shape", "Tester_", ")_", ":_", "\\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", "infer", "\\u", "shape_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shape_", "=_", "(_", "100_", ",_", "40_", ",_", "6_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "images_", "=_", "numpy_", "._", "ones_", "(_", "shape_", ")_", "._", "astype_", "(_", "'", "float", "32", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "T_", "._", "fte", "nsor", "4_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "self_", "._", "\\u", "compile", "\\u", "and", "\\u", "check_", "(_", "[_", "x_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "images", "2n", "ei", "bs_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "x_", ",_", "nei", "b", "\\u", "shape_", "=_", "(_", "2_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "'", "valid", "'_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "images_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Image", "s2", "Nei", "bs_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "self_", "._", "\\u", "compile", "\\u", "and", "\\u", "check_", "(_", "[_", "x_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "images", "2n", "ei", "bs_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "x_", ",_", "nei", "b", "\\u", "shape_", "=_", "(_", "2_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "'", "valid", "'_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "images_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Image", "s2", "Nei", "bs_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shape_", "=_", "(_", "100_", ",_", "40_", ",_", "5_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "images_", "=_", "numpy_", "._", "ones_", "(_", "shape_", ")_", "._", "astype_", "(_", "'", "float", "32", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "T_", "._", "fte", "nsor", "4_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "self_", "._", "\\u", "compile", "\\u", "and", "\\u", "check_", "(_", "[_", "x_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "images", "2n", "ei", "bs_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "x_", ",_", "nei", "b", "\\u", "shape_", "=_", "(_", "2_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "'", "ignore", "\\u", "border", "s", "'_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "images_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Image", "s2", "Nei", "bs_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shape_", "=_", "(_", "100_", ",_", "40_", ",_", "5_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "images_", "=_", "numpy_", "._", "ones_", "(_", "shape_", ")_", "._", "astype_", "(_", "'", "float", "32", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "T_", "._", "fte", "nsor", "4_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "self_", "._", "\\u", "compile", "\\u", "and", "\\u", "check_", "(_", "[_", "x_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "images", "2n", "ei", "bs_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "x_", ",_", "nei", "b", "\\u", "shape_", "=_", "(_", "2_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "'", "ignore", "\\u", "border", "s", "'_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "images_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Image", "s2", "Nei", "bs_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "shape_", "=_", "(_", "100_", ",_", "40_", ",_", "6_", ",_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "images_", "=_", "numpy_", "._", "ones_", "(_", "shape_", ")_", "._", "astype_", "(_", "'", "float", "32", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "T_", "._", "fte", "nsor", "4_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "self_", "._", "\\u", "compile", "\\u", "and", "\\u", "check_", "(_", "[_", "x_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "images", "2n", "ei", "bs_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "x_", ",_", "nei", "b", "\\u", "shape_", "=_", "(_", "2_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "'", "ignore", "\\u", "border", "s", "'_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "images_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Image", "s2", "Nei", "bs_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shape_", "=_", "(_", "100_", ",_", "40_", ",_", "5_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "images_", "=_", "numpy_", "._", "ones_", "(_", "shape_", ")_", "._", "astype_", "(_", "'", "float", "32", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "T_", "._", "fte", "nsor", "4_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "self_", "._", "\\u", "compile", "\\u", "and", "\\u", "check_", "(_", "[_", "x_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "images", "2n", "ei", "bs_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "x_", ",_", "nei", "b", "\\u", "shape_", "=_", "(_", "3_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "'", "wrap", "\\u", "centered", "'_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "images_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Image", "s2", "Nei", "bs_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Redundant comparison
mattharrison/rst2odp/odplib/imagescale.py
[ { "content": "def adjust_crop(dst_w, dst_h, img_w, img_h):\n \"\"\"\n given a x and y of dest, determine the ratio and return\n an (x,y,w,h) for a cropped image (note x or y could be neg).\n >>> adjust_crop(4,3,5,5)\n (0, -0.5, 4.0, 4.0)\n >>> adjust_crop(8,6,5,5)\n (0, -1.0, 8.0, 8.0)\n >>> adjust_crop(4,3,5,2)\n (-1.75, 0, 7.5, 3.0)\n >>> adjust_crop(8,6,5,2)\n (-3.5, 0, 15.0, 6.0)\n \"\"\"\n dst_w = float(dst_w)\n dst_h = float(dst_h)\n img_w = float(img_w)\n img_h = float(img_h)\n\n dst_ratio = float(dst_w)/dst_h\n\n img_ratio = float(img_w)/img_h\n\n if dst_ratio > img_ratio:\n scale = dst_w/img_w\n x = 0\n w = dst_w\n h = img_h * scale\n y = dst_h/2 - h/2\n\n elif dst_ratio <= img_ratio:\n scale = dst_h/img_h\n y = 0\n w = img_w * scale\n h = img_h * scale\n x = dst_w/2 - w/2\n\n return x,y,w,h", "metadata": "root.adjust_crop", "header": "['module', '___EOS___']", "index": 22 } ]
[ { "span": "dst_ratio <= img_ratio:", "start_line": 51, "start_column": 9, "end_line": 51, "end_column": 31 } ]
[ { "span": "dst_ratio > img_ratio:", "start_line": 44, "start_column": 7, "end_line": 44, "end_column": 28 } ]
1
true
[ "[CLS]_", "Redu", "ndan", "t_", "comparison_", "[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_", "adjust", "\\u", "crop_", "(_", "dst", "\\u", "w_", ",_", "dst", "\\u", "h_", ",_", "img", "\\u", "w_", ",_", "img", "\\u", "h_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "give", "n", " ", "a", " ", "x", " ", "and", " ", "y", " ", "of", " ", "dest", ",", " ", "dete", "rmin", "e", " ", "the", " ", "ratio", " ", "and", " ", "return", "\\", "10", ";", " ", " ", " ", " ", "an", " ", "(", "x", ",", "y", ",", "w", ",", "h", ")", " ", "for", " ", "a", " ", "cropped", " ", "image", " ", "(", "note", " ", "x", " ", "or", " ", "y", " ", "coul", "d", " ", "be", " ", "neg", ").", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "adjust", "\\u", "crop", "(", "4", ",", "3", ",", "5", ",", "5", ")", "\\", "10", ";", " ", " ", " ", " ", "(", "0", ",", " ", "-0", ".5", ",", " ", "4.0", ",", " ", "4.0", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "adjust", "\\u", "crop", "(", "8", ",", "6", ",", "5", ",", "5", ")", "\\", "10", ";", " ", " ", " ", " ", "(", "0", ",", " ", "-1", ".0", ",", " ", "8.0", ",", " ", "8.0", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "adjust", "\\u", "crop", "(", "4", ",", "3", ",", "5", ",", "2", ")", "\\", "10", ";", " ", " ", " ", " ", "(-", "1.7", "5", ",", " ", "0", ",", " ", "7.5", ",", " ", "3.0", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "adjust", "\\u", "crop", "(", "8", ",", "6", ",", "5", ",", "2", ")", "\\", "10", ";", " ", " ", " ", " ", "(-", "3.5", ",", " ", "0", ",", " ", "15.", "0", ",", " ", "6.0", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dst", "\\u", "w_", "=_", "float_", "(_", "dst", "\\u", "w_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dst", "\\u", "h_", "=_", "float_", "(_", "dst", "\\u", "h_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "img", "\\u", "w_", "=_", "float_", "(_", "img", "\\u", "w_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "img", "\\u", "h_", "=_", "float_", "(_", "img", "\\u", "h_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dst", "\\u", "ratio_", "=_", "float_", "(_", "dst", "\\u", "w_", ")_", "/_", "dst", "\\u", "h_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "img", "\\u", "ratio_", "=_", "float_", "(_", "img", "\\u", "w_", ")_", "/_", "img", "\\u", "h_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "dst", "\\u", "ratio_", ">_", "img", "\\u", "ratio_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scale_", "=_", "dst", "\\u", "w_", "/_", "img", "\\u", "w_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w_", "=_", "dst", "\\u", "w_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "=_", "img", "\\u", "h_", "*_", "scale_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "dst", "\\u", "h_", "/_", "2_", "-_", "h_", "/_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "dst", "\\u", "ratio_", "<=_", "img", "\\u", "ratio_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scale_", "=_", "dst", "\\u", "h_", "/_", "img", "\\u", "h_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w_", "=_", "img", "\\u", "w_", "*_", "scale_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "=_", "img", "\\u", "h_", "*_", "scale_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "dst", "\\u", "w_", "/_", "2_", "-_", "w_", "/_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "x_", ",_", "y_", ",_", "w_", ",_", "h_", "\\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, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
jfsantos/ift6266h14/old/exp_next_sample.py
[ { "content": "from pylearn2_timit.timitnext import TIMITnext\nimport itertools\nimport numpy as np\nfrom pylearn2.datasets import DenseDesignMatrix\nfrom pylearn2.models.mlp import *\nfrom pylearn2.costs.mlp.dropout import Dropout\nfrom pylearn2.termination_criteria import EpochCounter\nfrom pylearn2.training_algorithms.sgd import SGD\nfrom pylearn2.training_algorithms import learning_rule\nfrom pylearn2.train import Train\nfrom pylearn2.train_extensions import best_params\nfrom pylearn2.costs.cost import SumOfCosts\nfrom pylearn2.costs.mlp import *\nimport cPickle as pickle\nimport theano\nfrom sys import argv\n\nframe_len = 160\noverlap = frame_len-1\n\n#timit_root = argv[1]\n\ntrain = TIMITnext(\"train\", frame_len, overlap, start=0, stop=100)\nvalid = TIMITnext(\"valid\", frame_len, overlap, start=0, stop=10)\ntest = TIMITnext(\"test\", frame_len, overlap, start=0, stop=50)\n\n# Model used to predict the next sample. This model is never trained,\n# as it uses parameters predicted by the next model.\n\ni0 = VectorSpace(frame_len)\ns0 = Sigmoid(layer_name='h0', dim=500, sparse_init=150)\ns1 = Sigmoid(layer_name='h1', dim=250, sparse_init=75)\ns2 = Sigmoid(layer_name='h2', dim=100, sparse_init=15)\nl0 = Linear(layer_name='y', dim=1, sparse_init=1)\n\nmdl = MLP(layers=[s0, s1, s2, l0], nvis=frame_len, input_space=i0)\n\ntrainer = SGD(batch_size=128, learning_rate = .01, init_momentum = .5, monitoring_dataset = {'train' : train, 'valid': valid, 'test' : test}, termination_criterion = EpochCounter(max_epochs=20), cost = SumOfCosts([Default(), L1WeightDecay([0.01,0.01,0.01,0.01])]))\n \nwatcher = best_params.MonitorBasedSaveBest(\n channel_name='test_objective',\n save_path='nextsample.pkl')\n \nexperiment = Train(dataset=train,\n model=mdl,\n algorithm=trainer, extensions=[watcher])\n\nexperiment.main_loop()\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import itertools", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 16 }, { "span": "import numpy as np", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 18 }, { "span": "from pylearn2.datasets import DenseDesignMatrix", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 47 }, { "span": "from pylearn2.costs.mlp.dropout import Dropout", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 46 }, { "span": "from pylearn2.training_algorithms import learning_rule", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 54 }, { "span": "import cPickle as pickle", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 24 }, { "span": "import theano", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 13 }, { "span": "from sys import argv", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 20 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "pyl", "earn", "2", "\\u", "tim", "it_", "._", "tim", "it", "next_", "import_", "TI", "MIT", "next_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "itertools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyl", "earn", "2_", "._", "datasets_", "import_", "Den", "se", "Desig", "n", "Matrix_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyl", "earn", "2_", "._", "models_", "._", "mlp", "_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyl", "earn", "2_", "._", "costs_", "._", "mlp", "_", "._", "dropout_", "import_", "Dropout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyl", "earn", "2_", "._", "termination", "\\u", "criteria_", "import_", "Epoch", "Counter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyl", "earn", "2_", "._", "train", "ing", "\\u", "algorithms_", "._", "sgd", "_", "import_", "SGD", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyl", "earn", "2_", "._", "train", "ing", "\\u", "algorithms_", "import_", "learn", "ing", "\\u", "rule_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyl", "earn", "2_", "._", "train_", "import_", "Train_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyl", "earn", "2_", "._", "train", "\\u", "extensions_", "import_", "best", "\\u", "params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyl", "earn", "2_", "._", "costs_", "._", "cost_", "import_", "Sum", "Of", "Cost", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyl", "earn", "2_", "._", "costs_", "._", "mlp", "_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "c", "Pickle_", "as_", "pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "theano_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sys_", "import_", "argv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "frame", "\\u", "len_", "=_", "160_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "overlap_", "=_", "frame", "\\u", "len_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "tim", "it", "\\u", "root", " ", "=", " ", "argv", "[", "1", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "train_", "=_", "TI", "MIT", "next_", "(_", "\"", "train", "\"_", ",_", "frame", "\\u", "len_", ",_", "overlap_", ",_", "start_", "=_", "0_", ",_", "stop_", "=_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valid_", "=_", "TI", "MIT", "next_", "(_", "\"", "valid", "\"_", ",_", "frame", "\\u", "len_", ",_", "overlap_", ",_", "start_", "=_", "0_", ",_", "stop_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test_", "=_", "TI", "MIT", "next_", "(_", "\"", "test", "\"_", ",_", "frame", "\\u", "len_", ",_", "overlap_", ",_", "start_", "=_", "0_", ",_", "stop_", "=_", "50_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Model", " ", "used", " ", "to", " ", "predi", "ct", " ", "the", " ", "next", " ", "sample", ".", " ", "Thi", "s", " ", "model", " ", "is", " ", "neve", "r", " ", "trained", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "as", " ", "it", " ", "use", "s", " ", "parameter", "s", " ", "predi", "cte", "d", " ", "by", " ", "the", " ", "next", " ", "model", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "i0_", "=_", "Vector", "Space_", "(_", "frame", "\\u", "len_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s0_", "=_", "Sigm", "oid_", "(_", "layer", "\\u", "name_", "=_", "'", "h", "0", "'_", ",_", "dim_", "=_", "500_", ",_", "spars", "e\\u", "init_", "=_", "150_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s1_", "=_", "Sigm", "oid_", "(_", "layer", "\\u", "name_", "=_", "'", "h1", "'_", ",_", "dim_", "=_", "250_", ",_", "spars", "e\\u", "init_", "=_", "75_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s2_", "=_", "Sigm", "oid_", "(_", "layer", "\\u", "name_", "=_", "'", "h2", "'_", ",_", "dim_", "=_", "100_", ",_", "spars", "e\\u", "init_", "=_", "15_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l0_", "=_", "Linear_", "(_", "layer", "\\u", "name_", "=_", "'", "y", "'_", ",_", "dim_", "=_", "1_", ",_", "spars", "e\\u", "init_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mdl_", "=_", "MLP", "_", "(_", "layers_", "=_", "[_", "s0_", ",_", "s1_", ",_", "s2_", ",_", "l0_", "]_", ",_", "nvi", "s_", "=_", "frame", "\\u", "len_", ",_", "input", "\\u", "space_", "=_", "i0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "trainer_", "=_", "SGD", "_", "(_", "batch", "\\u", "size_", "=_", "128_", ",_", "learn", "ing", "\\u", "rate_", "=_", ".01_", ",_", "init", "\\u", "momentum_", "=_", ".5_", ",_", "monitorin", "g", "\\u", "dataset_", "=_", "{_", "'", "train", "'_", ":_", "train_", ",_", "'", "valid", "'_", ":_", "valid_", ",_", "'", "test", "'_", ":_", "test_", "}_", ",_", "termination", "\\u", "criterion_", "=_", "Epoch", "Counter_", "(_", "max", "\\u", "epochs_", "=_", "20_", ")_", ",_", "cost_", "=_", "Sum", "Of", "Cost", "s_", "(_", "[_", "Default_", "(_", ")_", ",_", "L1", "Weig", "ht", "Decay", "_", "(_", "[_", "0.01_", ",_", "0.01_", ",_", "0.01_", ",_", "0.01_", "]_", ")_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "watcher_", "=_", "best", "\\u", "params_", "._", "Monitor", "Base", "d", "Save", "Bes", "t_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "channel", "\\u", "name_", "=_", "'", "test\\u", "objecti", "ve", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "save", "\\u", "path_", "=_", "'", "next", "sample", ".", "pkl", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "experiment_", "=_", "Train_", "(_", "dataset_", "=_", "train_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model_", "=_", "mdl_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "algorithm_", "=_", "trainer_", ",_", "extensions_", "=_", "[_", "watcher_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "experiment_", "._", "main", "\\u", "loop_", "(_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 2, 0, 1, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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 ]
Unused local variable
rvanlaar/easy-transifex/src/transifex/transifex/resources/formats/xliff.py
[ { "content": " def _parse(self, is_source, lang_rules):\n \"\"\"\n Parses XLIFF file and exports all entries as GenericTranslations.\n \"\"\"\n resource = self.resource\n\n context = \"\"\n content = self.content.encode('utf-8')\n try:\n self.doc = xml.dom.minidom.parseString(content)\n root = self.doc.documentElement\n\n if root.tagName != \"xliff\":\n raise XliffParseError(_(\"Root element is not 'xliff'\"))\n for node in root.childNodes:\n if node.nodeType == node.ELEMENT_NODE and node.localName == \"file\":\n self.parse_tag_file(node, is_source)\n except Exception, e:\n XliffParseError(e.message)\n\n return self.doc.toxml()", "metadata": "root.XliffHandler._parse", "header": "['class', 'XliffHandler', '(', 'Handler', ')', ':', '___EOS___']", "index": 169 }, { "content": " def parse_tag_group(self, group_node, is_source=False, context=None):\n if not context:\n context = []\n if group_node.attributes['restype'].value == \"x-gettext-plurals\":\n pluralized = True\n nplural_file = 0\n nplural = self.language.get_pluralrules_numbers()\n trans_unit_nodes = []\n for node in group_node.childNodes:\n if node.nodeType == node.ELEMENT_NODE and node.localName == \"trans-unit\":\n nplural_file += 1\n trans_unit_nodes.append(node)\n if node.nodeType == node.ELEMENT_NODE and node.localName == \"context-group\":\n context.extend(self.parse_tag_context_group(node, is_source))\n source = \"\"\n source_node = trans_unit_nodes[nplural.index(1)].getElementsByTagName(\"source\")[0]\n if len(source_node.childNodes)>1:\n source = self._getText(source_node.childNodes)\n else:\n source = source_node.firstChild.data\n if is_source:\n if nplural_file != 2:\n raise self.HandlerParseError(_(\"Your source file has more than two plurals which is not supported.\"))\n for n, node in enumerate(trans_unit_nodes):\n if n == 0:\n rule = 1\n else:\n rule = 5\n self.parse_tag_trans_unit(node, is_source, [i for i in context], source_string = source, rule=rule)\n else:\n if nplural_file != len(nplural):\n raise self.HandlerParseError(_(\"Your translation file does not have the supported number of plurals.\"))\n\n for n, node in enumerate(trans_unit_nodes):\n self.parse_tag_trans_unit(node, is_source, [i for i in context], source_string = source, rule=nplural[n])\n return\n\n for node in group_node.childNodes:\n if node.nodeType == node.ELEMENT_NODE and node.localName == \"group\":\n self.parse_tag_group(node, is_source, [i for i in context])\n if node.nodeType == node.ELEMENT_NODE and node.localName == \"trans-unit\":\n self.parse_tag_trans_unit(node, is_source, [i for i in context])\n if node.nodeType == node.ELEMENT_NODE and node.localName == \"context-group\":\n # context-group has to be in XML before occurence of trans-unit, so it\n # is ok to populate context this way\n context.extend(self.parse_tag_context_group(node, is_source))\n # TODO prop-group, note, count-group\n # there is no way to handle bin-unit in transifex", "metadata": "root.XliffHandler.parse_tag_group", "header": "['class', 'XliffHandler', '(', 'Handler', ')', ':', '___EOS___']", "index": 204 } ]
[ { "span": "resource ", "start_line": 173, "start_column": 8, "end_line": 173, "end_column": 16 }, { "span": "context ", "start_line": 175, "start_column": 8, "end_line": 175, "end_column": 15 }, { "span": "pluralized ", "start_line": 208, "start_column": 12, "end_line": 208, "end_column": 22 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Xl", "iff", "Handler_", "(_", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "parse_", "(_", "self_", ",_", "is", "\\u", "source_", ",_", "lang", "\\u", "rules_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Pars", "es", " ", "XL", "IF", "F", " ", "file", " ", "and", " ", "export", "s", " ", "all", " ", "entri", "es", " ", "as", " ", "Gene", "ric", "Translat", "ion", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resource_", "=_", "self_", "._", "resource_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content_", "=_", "self_", "._", "content_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "doc_", "=_", "xml_", "._", "dom_", "._", "minidom_", "._", "parse", "String_", "(_", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "=_", "self_", "._", "doc_", "._", "document", "Element_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "root_", "._", "tag", "Name_", "!=_", "\"", "xli", "ff", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Xl", "iff", "Pars", "e", "Error_", "(_", "\\u_", "(_", "\"", "Roo", "t", " ", "element", " ", "is", " ", "not", " ", "'", "xli", "ff", "'\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "node_", "in_", "root_", "._", "child", "Nodes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "node_", "._", "node", "Type_", "==_", "node_", "._", "ELEMENT", "\\u", "NODE_", "and_", "node_", "._", "local", "Name_", "==_", "\"", "file", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "parse", "\\u", "tag", "\\u", "file_", "(_", "node_", ",_", "is", "\\u", "source_", ")_", "\\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_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Xl", "iff", "Pars", "e", "Error_", "(_", "e_", "._", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "doc_", "._", "tox", "ml_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "iff", "Handler_", "(_", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "\\u", "tag", "\\u", "group_", "(_", "self_", ",_", "group", "\\u", "node_", ",_", "is", "\\u", "source_", "=_", "False_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "context_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "group", "\\u", "node_", "._", "attributes_", "[_", "'", "rest", "ype", "'_", "]_", "._", "value_", "==_", "\"", "x", "-", "gettext", "-", "plural", "s", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plural", "ized_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "npl", "ural", "\\u", "file_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "npl", "ural", "_", "=_", "self_", "._", "language_", "._", "get", "\\u", "plural", "rule", "s", "\\u", "numbers_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trans", "\\u", "unit", "\\u", "nodes_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "node_", "in_", "group", "\\u", "node_", "._", "child", "Nodes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "node_", "._", "node", "Type_", "==_", "node_", "._", "ELEMENT", "\\u", "NODE_", "and_", "node_", "._", "local", "Name_", "==_", "\"", "trans", "-", "unit", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "npl", "ural", "\\u", "file_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trans", "\\u", "unit", "\\u", "nodes_", "._", "append_", "(_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "node_", "._", "node", "Type_", "==_", "node_", "._", "ELEMENT", "\\u", "NODE_", "and_", "node_", "._", "local", "Name_", "==_", "\"", "context", "-", "group", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "context_", "._", "extend_", "(_", "self_", "._", "parse", "\\u", "tag", "\\u", "context", "\\u", "group_", "(_", "node_", ",_", "is", "\\u", "source_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "source_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source", "\\u", "node_", "=_", "trans", "\\u", "unit", "\\u", "nodes_", "[_", "npl", "ural", "_", "._", "index_", "(_", "1_", ")_", "]_", "._", "get", "Element", "s", "By", "Ta", "g", "Name_", "(_", "\"", "source", "\"_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "source", "\\u", "node_", "._", "child", "Nodes_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "source_", "=_", "self_", "._", "\\u", "get", "Text_", "(_", "source", "\\u", "node_", "._", "child", "Nodes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "source_", "=_", "source", "\\u", "node_", "._", "first", "Child_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "source_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "npl", "ural", "\\u", "file_", "!=_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "self_", "._", "Handle", "r", "Pars", "e", "Error_", "(_", "\\u_", "(_", "\"", "You", "r", " ", "source", " ", "file", " ", "has", " ", "more", " ", "than", " ", "two", " ", "plural", "s", " ", "whi", "ch", " ", "is", " ", "not", " ", "support", "ed", ".\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "n_", ",_", "node_", "in_", "enumerate_", "(_", "trans", "\\u", "unit", "\\u", "nodes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "n_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "rule_", "=_", "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 ", " ", " _", "rule_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "parse", "\\u", "tag", "\\u", "trans", "\\u", "unit_", "(_", "node_", ",_", "is", "\\u", "source_", ",_", "[_", "i_", "for_", "i_", "in_", "context_", "]_", ",_", "source", "\\u", "string_", "=_", "source_", ",_", "rule_", "=_", "rule_", ")_", "\\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_", "npl", "ural", "\\u", "file_", "!=_", "len_", "(_", "npl", "ural", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "self_", "._", "Handle", "r", "Pars", "e", "Error_", "(_", "\\u_", "(_", "\"", "You", "r", " ", "translatio", "n", " ", "file", " ", "doe", "s", " ", "not", " ", "have", " ", "the", " ", "support", "ed", " ", "number", " ", "of", " ", "plural", "s", ".\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "n_", ",_", "node_", "in_", "enumerate_", "(_", "trans", "\\u", "unit", "\\u", "nodes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "parse", "\\u", "tag", "\\u", "trans", "\\u", "unit_", "(_", "node_", ",_", "is", "\\u", "source_", ",_", "[_", "i_", "for_", "i_", "in_", "context_", "]_", ",_", "source", "\\u", "string_", "=_", "source_", ",_", "rule_", "=_", "npl", "ural", "_", "[_", "n_", "]_", ")_", "\\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_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "node_", "in_", "group", "\\u", "node_", "._", "child", "Nodes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "node_", "._", "node", "Type_", "==_", "node_", "._", "ELEMENT", "\\u", "NODE_", "and_", "node_", "._", "local", "Name_", "==_", "\"", "group", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parse", "\\u", "tag", "\\u", "group_", "(_", "node_", ",_", "is", "\\u", "source_", ",_", "[_", "i_", "for_", "i_", "in_", "context_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "node_", "._", "node", "Type_", "==_", "node_", "._", "ELEMENT", "\\u", "NODE_", "and_", "node_", "._", "local", "Name_", "==_", "\"", "trans", "-", "unit", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parse", "\\u", "tag", "\\u", "trans", "\\u", "unit_", "(_", "node_", ",_", "is", "\\u", "source_", ",_", "[_", "i_", "for_", "i_", "in_", "context_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "node_", "._", "node", "Type_", "==_", "node_", "._", "ELEMENT", "\\u", "NODE_", "and_", "node_", "._", "local", "Name_", "==_", "\"", "context", "-", "group", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "context", "-", "group", " ", "has", " ", "to", " ", "be", " ", "in", " ", "XML", " ", "bef", "ore", " ", "occure", "nce", " ", "of", " ", "trans", "-", "unit", ",", " ", "so", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "ok", " ", "to", " ", "populate", " ", "context", " ", "this", " ", "way_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "._", "extend_", "(_", "self_", "._", "parse", "\\u", "tag", "\\u", "context", "\\u", "group_", "(_", "node_", ",_", "is", "\\u", "source_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", " ", "prop", "-", "group", ",", " ", "note", ",", " ", "count", "-", "group_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "there", " ", "is", " ", "no", " ", "way", " ", "to", " ", "handle", " ", "bin", "-", "unit", " ", "in", " ", "trans", "ife", "x_", "\\u\\u\\uNL\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 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, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Constant in conditional expression or statement
kayhayen/Nuitka/tests/optimizations/Conditions.py
[ { "content": "# Copyright 2016, Kay Hayen, mailto:[email protected]\n#\n# Python test originally created or extracted from other peoples work. The\n# parts from me are licensed as below. It is at least Free Software where\n# it's copied from other people. In these cases, that will normally be\n# indicated.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nprint(1 if [1,2] else 2)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "[1,2] ", "start_line": 20, "start_column": 11, "end_line": 20, "end_column": 16 } ]
[]
1
true
[ "[CLS]_", "Constant_", "in_", "conditional", "_", "expression_", "or_", "statement_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2016", ",", " ", "Ka", "y", " ", "Ha", "yen", ",", " ", "mail", "to", ":", "ka", "y", ".", "hay", "en", "@", "gma", "il", ".", "com_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pyth", "on", " ", "test", " ", "original", "ly", " ", "created", " ", "or", " ", "extracted", " ", "from", " ", "other", " ", "people", "s", " ", "work", ".", " ", "The", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "part", "s", " ", "from", " ", "me", " ", "are", " ", "license", "d", " ", "as", " ", "belo", "w", ".", " ", "It", " ", "is", " ", "at", " ", "leas", "t", " ", "Free", " ", "Sof", "twa", "re", " ", "where_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "it", "'", "s", " ", "copie", "d", " ", "from", " ", "other", " ", "people", ".", " ", "In", " ", "these", " ", "case", "s", ",", " ", "tha", "t", " ", "will", " ", "normal", "ly", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "indicat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "1_", "if_", "[_", "1_", ",_", "2_", "]_", "else_", "2_", ")_" ]
[ 4, 4, 4, 4, 4, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 2, 2, 2 ]
Unused local variable
StevenBlack/hosts/updateHostsFile.py
[ { "content": "def getUpdateURLsFromFile(source):\n pathToUpdateFile = os.path.join(settings[\"datapath\"], source, settings[\"updateurlfilename\"])\n if os.path.exists(pathToUpdateFile):\n updateFile = open(pathToUpdateFile, \"r\")\n retURLs = updateFile.readlines()\n # .strip()\n updateFile.close()\n else:\n retURL = None\n printFailure(\"Warning: Can't find the update file for source \" + source + \"\\n\" +\n \"Make sure that there's a file at \" + pathToUpdateFile)\n return retURLs", "metadata": "root.getUpdateURLsFromFile", "header": "['module', '___EOS___']", "index": 242 }, { "content": "def updateReadmeData():\n extensionsKey = \"base\"\n hostsLocation = \"\"\n if settings[\"extensions\"]:\n extensionsKey = \"-\".join(settings[\"extensions\"])\n\n generationData = {\"location\": os.path.join(settings[\"outputsubfolder\"], \"\"),\n \"entries\": settings[\"numberofrules\"]}\n settings[\"readmedata\"][extensionsKey] = generationData\n with open(settings[\"readmedatafilename\"], \"w\") as f:\n json.dump(settings[\"readmedata\"], f)", "metadata": "root.updateReadmeData", "header": "['module', '___EOS___']", "index": 402 }, { "content": "def moveHostsFileIntoPlace(finalFile):\n if os.name == \"posix\":\n dnsCacheFound = False\n print (\"Moving the file requires administrative privileges. \" +\n \"You might need to enter your password.\")\n if subprocess.call([\"/usr/bin/sudo\", \"cp\", os.path.abspath(finalFile.name), \"/etc/hosts\"]):\n printFailure(\"Moving the file failed.\")\n print (\"Flushing the DNS Cache to utilize new hosts file...\")\n if platform.system() == \"Darwin\":\n dnsCacheFound = True\n if subprocess.call([\"/usr/bin/sudo\", \"killall\", \"-HUP\", \"mDNSResponder\"]):\n printFailure(\"Flushing the DNS Cache failed.\")\n else:\n if os.path.isfile(\"/etc/rc.d/init.d/nscd\"):\n dnsCacheFound = True\n if subprocess.call([\"/usr/bin/sudo\", \"/etc/rc.d/init.d/nscd\", \"restart\"]):\n printFailure(\"Flushing the DNS Cache failed.\")\n else:\n printSuccess(\"Flushing DNS by restarting nscd succeeded\")\n if os.path.isfile(\"/usr/lib/systemd/system/NetworkManager.service\"):\n dnsCacheFound = True\n if subprocess.call([\"/usr/bin/sudo\", \"/usr/bin/systemctl\", \"restart\", \"NetworkManager.service\"]):\n printFailure(\"Flushing the DNS Cache failed.\")\n else:\n printSuccess(\"Flushing DNS by restarting NetworkManager succeeded\")\n if os.path.isfile(\"/usr/lib/systemd/system/wicd.service\"):\n dnsCacheFound = True\n if subprocess.call([\"/usr/bin/sudo\", \"/usr/bin/systemctl\", \"restart\", \"wicd.service\"]):\n printFailure(\"Flushing the DNS Cache failed.\")\n else:\n printSuccess(\"Flushing DNS by restarting wicd succeeded\")\n if os.path.isfile(\"/usr/lib/systemd/system/dnsmasq.service\"):\n dnsCacheFound = True\n if subprocess.call([\"/usr/bin/sudo\", \"/usr/bin/systemctl\", \"restart\", \"dnsmasq.service\"]):\n printFailure(\"Flushing the DNS Cache failed.\")\n else:\n printSuccess(\"Flushing DNS by restarting dnsmasq succeeded\")\n if os.path.isfile(\"/usr/lib/systemd/system/networking.service\"):\n dnsCacheFound = True\n if subprocess.call([\"/usr/bin/sudo\", \"/usr/bin/systemctl\", \"restart\", \"networking.service\"]):\n printFailure(\"Flushing the DNS Cache failed.\")\n else:\n printSuccess(\"Flushing DNS by restarting networking.service succeeded\")\n if not dnsCacheFound:\n printFailure(\"Unable to determine DNS management tool.\")\n elif os.name == \"nt\":\n print (\"Automatically moving the hosts file in place is not yet supported.\")\n print (\"Please move the generated file to %SystemRoot%\\system32\\drivers\\etc\\hosts\")", "metadata": "root.moveHostsFileIntoPlace", "header": "['module', '___EOS___']", "index": 414 } ]
[ { "span": "retURL ", "start_line": 250, "start_column": 8, "end_line": 250, "end_column": 14 }, { "span": "hostsLocation ", "start_line": 404, "start_column": 4, "end_line": 404, "end_column": 17 }, { "span": "dnsCacheFound ", "start_line": 423, "start_column": 12, "end_line": 423, "end_column": 25 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Update", "URL", "s", "Fro", "m", "File_", "(_", "source_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path", "To", "Update", "File_", "=_", "os_", "._", "path_", "._", "join_", "(_", "settings_", "[_", "\"", "datapath", "\"_", "]_", ",_", "source_", ",_", "settings_", "[_", "\"", "update", "urlf", "ilen", "ame", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "path", "To", "Update", "File_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "update", "File_", "=_", "open_", "(_", "path", "To", "Update", "File_", ",_", "\"", "r", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret", "URL", "s_", "=_", "update", "File_", "._", "readlines_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", ".", "strip", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "update", "File_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret", "URL_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "Failure_", "(_", "\"", "Warn", "ing", ":", " ", "Can", "'", "t", " ", "find", " ", "the", " ", "update", " ", "file", " ", "for", " ", "source", " ", "\"_", "+_", "source_", "+_", "\"\\\\", "n", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Make", " ", "sure", " ", "tha", "t", " ", "there", "'", "s", " ", "a", " ", "file", " ", "at", " ", "\"_", "+_", "path", "To", "Update", "File_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ret", "URL", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "Read", "me", "Data_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "extensi", "ons", "Key_", "=_", "\"", "base", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host", "s", "Location_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "settings_", "[_", "\"", "extensi", "ons", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "extensi", "ons", "Key_", "=_", "\"-\"_", "._", "join_", "(_", "settings_", "[_", "\"", "extensi", "ons", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "generat", "ion", "Data_", "=_", "{_", "\"", "location", "\"_", ":_", "os_", "._", "path_", "._", "join_", "(_", "settings_", "[_", "\"", "output", "subfolder", "\"_", "]_", ",_", "\"\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "entri", "es", "\"_", ":_", "settings_", "[_", "\"", "number", "of", "rule", "s", "\"_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "settings_", "[_", "\"", "readme", "data", "\"_", "]_", "[_", "extensi", "ons", "Key_", "]_", "=_", "generat", "ion", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "settings_", "[_", "\"", "readme", "datafile", "name", "\"_", "]_", ",_", "\"", "w", "\"_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "json_", "._", "dump_", "(_", "settings_", "[_", "\"", "readme", "data", "\"_", "]_", ",_", "f_", ")_", "\\u\\u\\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_", "move", "Host", "s", "File", "Int", "o", "Place_", "(_", "final", "File_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "os_", "._", "name_", "==_", "\"", "posix", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dns", "Cache", "Found_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Movi", "ng", " ", "the", " ", "file", " ", "require", "s", " ", "administrati", "ve", " ", "privilege", "s", ".", " ", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "You", " ", "mig", "ht", " ", "need", " ", "to", " ", "enter", " ", "your", " ", "password", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "subprocess_", "._", "call_", "(_", "[_", "\"/", "usr", "/", "bin", "/", "sudo", "\"_", ",_", "\"", "cp", "\"_", ",_", "os_", "._", "path_", "._", "abspath_", "(_", "final", "File_", "._", "name_", ")_", ",_", "\"/", "etc", "/", "host", "s", "\"_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print", "Failure_", "(_", "\"", "Movi", "ng", " ", "the", " ", "file", " ", "fail", "ed", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "\"", "Flu", "shing", " ", "the", " ", "DNS", " ", "Cache", " ", "to", " ", "utiliz", "e", " ", "new", " ", "host", "s", " ", "file", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "platform_", "._", "system_", "(_", ")_", "==_", "\"", "Dar", "win", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dns", "Cache", "Found_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "subprocess_", "._", "call_", "(_", "[_", "\"/", "usr", "/", "bin", "/", "sudo", "\"_", ",_", "\"", "kill", "all", "\"_", ",_", "\"-", "HU", "P", "\"_", ",_", "\"", "m", "DNS", "Responde", "r", "\"_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print", "Failure_", "(_", "\"", "Flu", "shing", " ", "the", " ", "DNS", " ", "Cache", " ", "fail", "ed", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "\"/", "etc", "/", "rc", ".", "d", "/", "init", ".", "d", "/", "nsc", "d", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dns", "Cache", "Found_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "subprocess_", "._", "call_", "(_", "[_", "\"/", "usr", "/", "bin", "/", "sudo", "\"_", ",_", "\"/", "etc", "/", "rc", ".", "d", "/", "init", ".", "d", "/", "nsc", "d", "\"_", ",_", "\"", "restart", "\"_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print", "Failure_", "(_", "\"", "Flu", "shing", " ", "the", " ", "DNS", " ", "Cache", " ", "fail", "ed", ".\"_", ")_", "\\u\\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", "Success_", "(_", "\"", "Flu", "shing", " ", "DNS", " ", "by", " ", "restart", "ing", " ", "nsc", "d", " ", "succe", "eded", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "\"/", "usr", "/", "lib", "/", "system", "d", "/", "system", "/", "Network", "Manager", ".", "service", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dns", "Cache", "Found_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "subprocess_", "._", "call_", "(_", "[_", "\"/", "usr", "/", "bin", "/", "sudo", "\"_", ",_", "\"/", "usr", "/", "bin", "/", "system", "ctl", "\"_", ",_", "\"", "restart", "\"_", ",_", "\"", "Network", "Manager", ".", "service", "\"_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print", "Failure_", "(_", "\"", "Flu", "shing", " ", "the", " ", "DNS", " ", "Cache", " ", "fail", "ed", ".\"_", ")_", "\\u\\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", "Success_", "(_", "\"", "Flu", "shing", " ", "DNS", " ", "by", " ", "restart", "ing", " ", "Network", "Manager", " ", "succe", "eded", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "\"/", "usr", "/", "lib", "/", "system", "d", "/", "system", "/", "wic", "d", ".", "service", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dns", "Cache", "Found_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "subprocess_", "._", "call_", "(_", "[_", "\"/", "usr", "/", "bin", "/", "sudo", "\"_", ",_", "\"/", "usr", "/", "bin", "/", "system", "ctl", "\"_", ",_", "\"", "restart", "\"_", ",_", "\"", "wic", "d", ".", "service", "\"_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print", "Failure_", "(_", "\"", "Flu", "shing", " ", "the", " ", "DNS", " ", "Cache", " ", "fail", "ed", ".\"_", ")_", "\\u\\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", "Success_", "(_", "\"", "Flu", "shing", " ", "DNS", " ", "by", " ", "restart", "ing", " ", "wic", "d", " ", "succe", "eded", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "\"/", "usr", "/", "lib", "/", "system", "d", "/", "system", "/", "dnsm", "asq", ".", "service", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dns", "Cache", "Found_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "subprocess_", "._", "call_", "(_", "[_", "\"/", "usr", "/", "bin", "/", "sudo", "\"_", ",_", "\"/", "usr", "/", "bin", "/", "system", "ctl", "\"_", ",_", "\"", "restart", "\"_", ",_", "\"", "dnsm", "asq", ".", "service", "\"_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print", "Failure_", "(_", "\"", "Flu", "shing", " ", "the", " ", "DNS", " ", "Cache", " ", "fail", "ed", ".\"_", ")_", "\\u\\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", "Success_", "(_", "\"", "Flu", "shing", " ", "DNS", " ", "by", " ", "restart", "ing", " ", "dnsm", "asq", " ", "succe", "eded", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "\"/", "usr", "/", "lib", "/", "system", "d", "/", "system", "/", "networking", ".", "service", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dns", "Cache", "Found_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "subprocess_", "._", "call_", "(_", "[_", "\"/", "usr", "/", "bin", "/", "sudo", "\"_", ",_", "\"/", "usr", "/", "bin", "/", "system", "ctl", "\"_", ",_", "\"", "restart", "\"_", ",_", "\"", "networking", ".", "service", "\"_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print", "Failure_", "(_", "\"", "Flu", "shing", " ", "the", " ", "DNS", " ", "Cache", " ", "fail", "ed", ".\"_", ")_", "\\u\\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", "Success_", "(_", "\"", "Flu", "shing", " ", "DNS", " ", "by", " ", "restart", "ing", " ", "networking", ".", "service", " ", "succe", "eded", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "dns", "Cache", "Found_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print", "Failure_", "(_", "\"", "Una", "ble", " ", "to", " ", "dete", "rmin", "e", " ", "DNS", " ", "manage", "ment", " ", "tool", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "os_", "._", "name_", "==_", "\"", "nt", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Automat", "ical", "ly", " ", "movin", "g", " ", "the", " ", "host", "s", " ", "file", " ", "in", " ", "place", " ", "is", " ", "not", " ", "ye", "t", " ", "support", "ed", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"",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, 2, 2, 2, 2, 2 ]
Unnecessary pass
django-extensions/django-extensions/django_extensions/management/commands/runserver_plus.py
[ { "content": " @signalcommand\n def handle(self, addrport='', *args, **options):\n import django\n\n startup_messages = options.get('startup_messages', 'reload')\n if startup_messages == \"reload\":\n self.show_startup_messages = os.environ.get('RUNSERVER_PLUS_SHOW_MESSAGES')\n elif startup_messages == \"once\":\n self.show_startup_messages = not os.environ.get('RUNSERVER_PLUS_SHOW_MESSAGES')\n elif startup_messages == \"never\":\n self.show_startup_messages = False\n else:\n self.show_startup_messages = True\n\n os.environ['RUNSERVER_PLUS_SHOW_MESSAGES'] = '1'\n\n # Do not use default ending='\\n', because StreamHandler() takes care of it\n if hasattr(self.stderr, 'ending'):\n self.stderr.ending = None\n\n setup_logger(logger, self.stderr, filename=options.get('output_file', None)) # , fmt=\"[%(name)s] %(message)s\")\n logredirect = RedirectHandler(__name__)\n\n # Redirect werkzeug log items\n werklogger = logging.getLogger('werkzeug')\n werklogger.setLevel(logging.INFO)\n werklogger.addHandler(logredirect)\n werklogger.propagate = False\n\n if options.get(\"print_sql\", False):\n try:\n # Django 1.7 onwards\n from django.db.backends import utils\n except ImportError:\n # Django 1.6 below\n from django.db.backends import util as utils\n\n try:\n import sqlparse\n except ImportError:\n sqlparse = None # noqa\n\n class PrintQueryWrapper(utils.CursorDebugWrapper):\n def execute(self, sql, params=()):\n starttime = time.time()\n try:\n return self.cursor.execute(sql, params)\n finally:\n raw_sql = self.db.ops.last_executed_query(self.cursor, sql, params)\n execution_time = time.time() - starttime\n therest = ' -- [Execution time: %.6fs] [Database: %s]' % (execution_time, self.db.alias)\n if sqlparse:\n logger.info(sqlparse.format(raw_sql, reindent=True) + therest)\n else:\n logger.info(raw_sql + therest)\n\n utils.CursorDebugWrapper = PrintQueryWrapper\n\n try:\n from django.core.servers.basehttp import AdminMediaHandler\n USE_ADMINMEDIAHANDLER = True\n except ImportError:\n USE_ADMINMEDIAHANDLER = False\n\n try:\n from django.core.servers.basehttp import get_internal_wsgi_application as WSGIHandler\n except ImportError:\n from django.core.handlers.wsgi import WSGIHandler # noqa\n\n try:\n from werkzeug import run_simple, DebuggedApplication\n\n # Set colored output\n if settings.DEBUG:\n try:\n set_werkzeug_log_color()\n except: # We are dealing with some internals, anything could go wrong\n if self.show_startup_messages:\n print(\"Wrapping internal werkzeug logger for color highlighting has failed!\")\n pass\n\n except ImportError:\n raise CommandError(\"Werkzeug is required to use runserver_plus. Please visit http://werkzeug.pocoo.org/ or install via pip. (pip install Werkzeug)\")\n\n pdb_option = options.get('pdb', False)\n ipdb_option = options.get('ipdb', False)\n pm = options.get('pm', False)\n try:\n from django_pdb.middleware import PdbMiddleware\n except ImportError:\n if pdb_option or ipdb_option or pm:\n raise CommandError(\"django-pdb is required for --pdb, --ipdb and --pm options. Please visit https://pypi.python.org/pypi/django-pdb or install via pip. (pip install django-pdb)\")\n pm = False\n else:\n # Add pdb middleware if --pdb is specified or if in DEBUG mode\n middleware = 'django_pdb.middleware.PdbMiddleware'\n if (pdb_option or ipdb_option or settings.DEBUG) and middleware not in settings.MIDDLEWARE_CLASSES:\n settings.MIDDLEWARE_CLASSES += (middleware,)\n\n # If --pdb is specified then always break at the start of views.\n # Otherwise break only if a 'pdb' query parameter is set in the url\n if pdb_option:\n PdbMiddleware.always_break = 'pdb'\n elif ipdb_option:\n PdbMiddleware.always_break = 'ipdb'\n\n def postmortem(request, exc_type, exc_value, tb):\n if has_ipdb():\n import ipdb\n p = ipdb\n else:\n import pdb\n p = pdb\n print >>sys.stderr, \"Exception occured: %s, %s\" % (exc_type,\n exc_value)\n p.post_mortem(tb)\n\n # usurp django's handler\n from django.views import debug\n debug.technical_500_response = postmortem if pm else null_technical_500_response\n\n self.use_ipv6 = options.get('use_ipv6')\n if self.use_ipv6 and not socket.has_ipv6:\n raise CommandError('Your Python does not support IPv6.')\n self._raw_ipv6 = False\n if not addrport:\n try:\n addrport = settings.RUNSERVERPLUS_SERVER_ADDRESS_PORT\n except AttributeError:\n pass\n if not addrport:\n self.addr = ''\n self.port = DEFAULT_PORT\n else:\n m = re.match(naiveip_re, addrport)\n if m is None:\n raise CommandError('\"%s\" is not a valid port number '\n 'or address:port pair.' % addrport)\n self.addr, _ipv4, _ipv6, _fqdn, self.port = m.groups()\n if not self.port.isdigit():\n raise CommandError(\"%r is not a valid port number.\" %\n self.port)\n if self.addr:\n if _ipv6:\n self.addr = self.addr[1:-1]\n self.use_ipv6 = True\n self._raw_ipv6 = True\n elif self.use_ipv6 and not _fqdn:\n raise CommandError('\"%s\" is not a valid IPv6 address.'\n % self.addr)\n if not self.addr:\n self.addr = '::1' if self.use_ipv6 else '127.0.0.1'\n\n threaded = options.get('threaded', True)\n use_reloader = options.get('use_reloader', True)\n open_browser = options.get('open_browser', False)\n cert_path = options.get(\"cert_path\")\n quit_command = (sys.platform == 'win32') and 'CTRL-BREAK' or 'CONTROL-C'\n bind_url = \"http://%s:%s/\" % (\n self.addr if not self._raw_ipv6 else '[%s]' % self.addr, self.port)\n extra_files = options.get('extra_files', None) or []\n reloader_interval = options.get('reloader_interval', 1)\n\n def inner_run():\n if self.show_startup_messages:\n print(\"Performing system checks...\\n\")\n if hasattr(self, 'check'):\n self.check(display_num_errors=self.show_startup_messages)\n else:\n self.validate(display_num_errors=self.show_startup_messages)\n if HAS_MIGRATIONS:\n try:\n self.check_migrations()\n except ImproperlyConfigured:\n pass\n if self.show_startup_messages:\n print(\"\\nDjango version %s, using settings %r\" % (django.get_version(), settings.SETTINGS_MODULE))\n print(\"Development server is running at %s\" % (bind_url,))\n print(\"Using the Werkzeug debugger (http://werkzeug.pocoo.org/)\")\n print(\"Quit the server with %s.\" % quit_command)\n path = options.get('admin_media_path', '')\n if not path:\n admin_media_path = os.path.join(django.__path__[0], 'contrib/admin/static/admin')\n if os.path.isdir(admin_media_path):\n path = admin_media_path\n else:\n path = os.path.join(django.__path__[0], 'contrib/admin/media')\n handler = WSGIHandler()\n if USE_ADMINMEDIAHANDLER:\n handler = AdminMediaHandler(handler, path)\n if USE_STATICFILES:\n use_static_handler = options.get('use_static_handler', True)\n insecure_serving = options.get('insecure_serving', False)\n if use_static_handler and (settings.DEBUG or insecure_serving):\n handler = StaticFilesHandler(handler)\n if open_browser:\n import webbrowser\n webbrowser.open(bind_url)\n if cert_path:\n \"\"\"\n OpenSSL is needed for SSL support.\n\n This will make flakes8 throw warning since OpenSSL is not used\n directly, alas, this is the only way to show meaningful error\n messages. See:\n http://lucumr.pocoo.org/2011/9/21/python-import-blackbox/\n for more information on python imports.\n \"\"\"\n try:\n import OpenSSL # NOQA\n except ImportError:\n raise CommandError(\"Python OpenSSL Library is \"\n \"required to use runserver_plus with ssl support. \"\n \"Install via pip (pip install pyOpenSSL).\")\n\n dir_path, cert_file = os.path.split(cert_path)\n if not dir_path:\n dir_path = os.getcwd()\n root, ext = os.path.splitext(cert_file)\n certfile = os.path.join(dir_path, root + \".crt\")\n keyfile = os.path.join(dir_path, root + \".key\")\n try:\n from werkzeug.serving import make_ssl_devcert\n if os.path.exists(certfile) and \\\n os.path.exists(keyfile):\n ssl_context = (certfile, keyfile)\n else: # Create cert, key files ourselves.\n ssl_context = make_ssl_devcert(\n os.path.join(dir_path, root), host='localhost')\n except ImportError:\n if self.show_startup_messages:\n print(\"Werkzeug version is less than 0.9, trying adhoc certificate.\")\n ssl_context = \"adhoc\"\n\n else:\n ssl_context = None\n\n if use_reloader and settings.USE_I18N:\n try:\n from django.utils.autoreload import gen_filenames\n except ImportError:\n pass\n else:\n extra_files.extend(filter(lambda filename: filename.endswith('.mo'), gen_filenames()))\n\n run_simple(\n self.addr,\n int(self.port),\n DebuggedApplication(handler, True),\n use_reloader=use_reloader,\n use_debugger=True,\n extra_files=extra_files,\n reloader_interval=reloader_interval,\n threaded=threaded,\n ssl_context=ssl_context,\n )\n inner_run()", "metadata": "root.Command.handle", "header": "['class', 'Command', '(', 'BaseCommand', ')', ':', '___EOS___']", "index": 95 } ]
[ { "span": "pass", "start_line": 174, "start_column": 20, "end_line": 174, "end_column": 24 } ]
[]
1
true
[ "[CLS]_", "Un", "necessar", "y_", "pass_", "[SEP]_", "class_", "Command_", "(_", "Base", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "signal", "command_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "handle_", "(_", "self_", ",_", "addr", "port_", "=_", "''_", ",_", "*_", "args_", ",_", "**_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "django_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "start", "up", "\\u", "messages_", "=_", "options_", "._", "get_", "(_", "'", "start", "up", "\\u", "message", "s", "'_", ",_", "'", "relo", "ad", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "start", "up", "\\u", "messages_", "==_", "\"", "relo", "ad", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "show", "\\u", "start", "up", "\\u", "messages_", "=_", "os_", "._", "environ_", "._", "get_", "(_", "'", "RUN", "SERVER", "\\u", "PLUS", "\\u", "SHOW", "\\u", "MESSAGE", "S", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "start", "up", "\\u", "messages_", "==_", "\"", "onc", "e", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "show", "\\u", "start", "up", "\\u", "messages_", "=_", "not_", "os_", "._", "environ_", "._", "get_", "(_", "'", "RUN", "SERVER", "\\u", "PLUS", "\\u", "SHOW", "\\u", "MESSAGE", "S", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "start", "up", "\\u", "messages_", "==_", "\"", "neve", "r", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "show", "\\u", "start", "up", "\\u", "messages_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "show", "\\u", "start", "up", "\\u", "messages_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "environ_", "[_", "'", "RUN", "SERVER", "\\u", "PLUS", "\\u", "SHOW", "\\u", "MESSAGE", "S", "'_", "]_", "=_", "'", "1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Do", " ", "not", " ", "use", " ", "default", " ", "ending", "='", "\\\\", "n", "',", " ", "bec", "aus", "e", " ", "Stream", "Handle", "r", "()", " ", "take", "s", " ", "care", " ", "of", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "self_", "._", "stderr_", ",_", "'", "ending", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "stderr_", "._", "ending_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "setup", "\\u", "logger_", "(_", "logger_", ",_", "self_", "._", "stderr_", ",_", "filename_", "=_", "options_", "._", "get_", "(_", "'", "output", "\\u", "file", "'_", ",_", "None_", ")_", ")_", "#", " ", ",", " ", "fmt", "=\"", "[", "%", "(", "name", ")", "s", "]", " ", "%", "(", "message", ")", "s", "\")", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logr", "edi", "rect_", "=_", "Redirect", "Handler_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Redirect", " ", "werk", "zeu", "g", " ", "log", " ", "items_", "\\u\\u\\uNL\\u\\u\\u_", "werk", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "'", "werk", "zeu", "g", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "werk", "logger_", "._", "set", "Level_", "(_", "logging_", "._", "INFO_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "werk", "logger_", "._", "add", "Handler_", "(_", "logr", "edi", "rect_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "werk", "logger_", "._", "propagate_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "options_", "._", "get_", "(_", "\"", "print", "\\u", "sql", "\"_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Dj", "ang", "o", " ", "1.7", " ", "on", "ward", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "django_", "._", "db_", "._", "backends_", "import_", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Dj", "ang", "o", " ", "1.6", " ", "below_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "django_", "._", "db_", "._", "backends_", "import_", "util_", "as_", "utils_", "\\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 ", " _", "import_", "sql", "parse_", "\\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 ", " _", "sql", "parse_", "=_", "None_", "#", " ", "no", "qa_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Print", "Query", "Wrapper_", "(_", "utils_", "._", "Curs", "or", "Deb", "ug", "Wrapper_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "execute_", "(_", "self_", ",_", "sql_", ",_", "params_", "=_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "starttime_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "return_", "self_", "._", "cursor_", "._", "execute_", "(_", "sql_", ",_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raw", "\\u", "sql_", "=_", "self_", "._", "db_", "._", "ops_", "._", "last", "\\u", "executed", "\\u", "query_", "(_", "self_", "._", "cursor_", ",_", "sql_", ",_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "executi", "on", "\\u", "time_", "=_", "time_", "._", "time_", "(_", ")_", "-_", "starttime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "there", "st_", "=_", "'", " ", "--", " ", "[", "Execut", "ion", " ", "time", ":", " ", "%", ".6", "fs", "]", " ", "[", "Databa", "se", ":", " ", "%", "s", "]'_", "%_", "(_", "executi", "on", "\\u", "time_", ",_", "self_", "._", "db_", "._", "alias_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sql", "parse_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "logger_", "._", "info_", "(_", "sql", "parse_", "._", "format_", "(_", "raw", "\\u", "sql_", ",_", "rein", "dent_", "=_", "True_", ")_", "+_", "there", "st_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "logger_", "._", "info_", "(_", "raw", "\\u", "sql_", "+_", "there", "st_", ")_", "\\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_", "utils_", "._", "Curs", "or", "Deb", "ug", "Wrapper_", "=_", "Print", "Query", "Wrapper_", "\\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 ", " _", "from_", "django_", "._", "core_", "._", "servers_", "._", "base", "http_", "import_", "Admi", "n", "Media", "Handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "USE", "\\u", "ADM", "IN", "MEDIA", "HANDLER", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "USE", "\\u", "ADM", "IN", "MEDIA", "HANDLER", "_", "=_", "False_", "\\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 ", " _", "from_", "django_", "._", "core_", "._", "servers_", "._", "base", "http_", "import_", "get", "\\u", "internal", "\\u", "wsgi", "\\u", "application_", "as_", "WS", "GI", "Handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "django_", "._", "core_", "._", "handlers_", "._", "wsgi_", "import_", "WS", "GI", "Handler_", "#", " ", "no", "qa_", "\\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 ", " _", "from_", "werkzeug_", "import_", "run", "\\u", "simple_", ",_", "Deb", "ugg", "ed", "Application_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "colore", "d", " ", "output_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "settings_", "._", "DEBUG_", ":_", "\\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 ", " ", "_", "set\\u", "werk", "zeu", "g", "\\u", "log", "\\u", "color_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "#", " ", "We", " ", "are", " ", "deal", "ing", " ", "with", " ", "some", " ", "internals", ",", " ", "anyt", "hing", " ", "coul", "d", " ", "go", " ", "wrong", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "self_", "._", "show", "\\u", "start", "up", "\\u", "messages_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "(_", "\"", "Wrapp", "ing", " ", "internal", " ", "werk", "zeu", "g", " ", "logg", "er", " ", "for", " ", "color", " ", "highlight", "ing", " ", "has", " ", "fail", "ed", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Command", "Error_", "(_", "\"", "Wer", "kz", "eu", "g", " ", "is", " ", "require", "d", " ", "to", " ", "use", " ", "runs", "erver", "\\u", "plus", ".", " ", " ", "Ple", "ase", " ", "visit", " ", "http", "://", "werk", "zeu", "g", ".", "poc", "oo", ".", "org", "/", " ", "or", " ", "install", " ", "via", " ", "pip", ".", " ", "(", "pip", " ", "install", " ", "Wer", "kz", "eu", "g", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pdb", "\\u", "option_", "=_", "options_", "._", "get_", "(_", "'", "pdb", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ipd", "b", "\\u", "option_", "=_", "options_", "._", "get_", "(_", "'", "ipd", "b", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pm_", "=_", "options_", "._", "get_", "(_", "'", "pm", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "django", "\\u", "pdb_", "._", "middleware_", "import_", "Pd", "b", "Middleware_", "\\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 ", " _", "if_", "pdb", "\\u", "option_", "or_", "ipd", "b", "\\u", "option_", "or_", "pm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Command", "Error_", "(_", "\"", "django", "-", "pdb", " ", "is", " ", "require", "d", " ", "for", " ", "--", "pdb", ",", " ", "--", "ipd", "b", " ", "and", " ", "--", "pm", " ", "options", ".", " ", "Ple", "ase", " ", "visit", " ", "https", "://", "pypi", ".", "python", ".", "org", "/", "pypi", "/", "django", "-", "pdb", " ", "or", " ", "install", " ", "via", " ", "pip", ".", " ", "(", "pip", " ", "install", " ", "django", "-", "pdb", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pm_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Add", " ", "pdb", " ", "middle", "ware", " ", "if", " ", "--", "pdb", " ", "is", " ", "specified", " ", "or", " ", "if", " ", "in", " ", "DEBU", "G", " ", "mode_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "middleware_", "=_", "'", "django", "\\u", "pdb", ".", "middle", "ware", ".", "Pd", "b", "Mid", "dle", "ware", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "pdb", "\\u", "option_", "or_", "ipd", "b", "\\u", "option_", "or_", "settings_", "._", "DEBUG_", ")_", "and_", "middleware_", "not_", "in_", "settings_", "._", "MIDDLE", "WARE", "\\u", "CLASSES_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "settings_", "._", "MIDDLE", "WARE", "\\u", "CLASSES_", "+=_", "(_", "middleware_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "--", "pdb", " ", "is", " ", "specified", " ", "then", " ", "alw", "ay", "s", " ", "break", " ", "at", " ", "the", " ", "start", " ", "of", " ", "views", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ot", "her", "wis", "e", " ", "break", " ", "only", " ", "if", " ", "a", " ", "'", "pdb", "'", " ", "query", " ", "parameter", " ", "is", " ", "set", " ", "in", " ", "the", " ", "url_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "pdb", "\\u", "option_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Pd", "b", "Middleware_", "._", "alw", "ay", "s", "\\u", "break_", "=_", "'", "pdb", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "ipd", "b", "\\u", "option_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Pd", "b", "Middleware_", "._", "alw", "ay", "s", "\\u", "break_", "=_", "'", "ipd", "b", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "post", "mort", "em_", "(_", "request_", ",_", "exc", "\\u", "type_", ",_", "exc", "\\u", "value_", ",_", "tb_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "has", "\\u", "ipd", "b_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "import_", "ipd", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "ipd", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "import_", "pdb_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "pdb_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", ">>_", "sys_", "._", "stderr_", ",_", "\"", "Except", "ion", " ", "occure", "d", ":", " ", "%", "s", ",", " ", "%", "s", "\"_", "%_", "(_", "exc", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "exc", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "post", "\\u", "mort", "em_", "(_", "tb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "usu", "rp", " ", "django", "'", "s", " ", "handler_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "django_", "._", "views_", "import_", "debug_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "debug_", "._", "technical", "\\u", "500", "\\u", "response_", "=_", "post", "mort", "em_", "if_", "pm_", "else_", "null", "\\u", "technical", "\\u", "500", "\\u", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "use", "\\u", "ipv6_", "=_", "options_", "._", "get_", "(_", "'", "use", "\\u", "ipv", "6", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "use", "\\u", "ipv6_", "and_", "not_", "socket_", "._", "has", "\\u", "ipv6_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Command", "Error_", "(_", "'", "You", "r", " ", "Pyth", "on", " ", "doe", "s", " ", "not", " ", "support", " ", "IP", "v6", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "raw", "\\u", "ipv6_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "addr", "port_", ":_", "\\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 ", " _", "addr", "port_", "=_", "settings_", "._", "RUN", "SERVER", "PLUS", "\\u", "SERVER", "\\u", "ADDR", "ESS", "\\u", "PORT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "addr", "port_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "addr_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "port_", "=_", "DEF", "AUL", "T", "\\u", "PORT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "re_", "._", "match_", "(_", "naive", "ip", "\\u", "re_", ",_", "addr", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Command", "Error_", "(_", "'\"", "%", "s", "\"", " ", "is", " ", "not", " ", "a", " ", "valid", " ", "port", " ", "number", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "or", " ", "address", ":", "port", " ", "pair", ".'_", "%_", "addr", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "addr_", ",_", "\\u", "ipv4_", ",_", "\\u", "ipv6_", ",_", "\\u", "fqdn_", ",_", "self_", "._", "port_", "=_", "m_", "._", "groups_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "port_", "._", "isdigit_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Command", "Error_", "(_", "\"%", "r", " ", "is", " ", "not", " ", "a", " ", "valid", " ", "port", " ", "number", ".\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "addr_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u", "ipv6_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "addr_", "=_", "self_", "._", "addr_", "[_", "1_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "use", "\\u", "ipv6_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "raw", "\\u", "ipv6_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "use", "\\u", "ipv6_", "and_", "not_", "\\u", "fqdn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Command", "Error_", "(_", "'\"", "%", "s", "\"", " ", "is", " ", "not", " ", "a", " ", "valid", " ", "IP", "v6", " ", "address", ".'_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "self_", "._", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "addr_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "addr_", "=_", "':", ":", "1", "'_", "if_", "self_", "._", "use", "\\u", "ipv6_", "else_", "'", "127", ".0", ".0", ".1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "threaded", "_", "=_", "options_", "._", "get_", "(_", "'", "threaded", "'_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "use", "\\u", "reloade", "r_", "=_", "options_", "._", "get_", "(_", "'", "use", "\\u", "reloade", "r", "'_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open", "\\u", "browser_", "=_", "options_", "._", "get_", "(_", "'", "open", "\\u", "browse", "r", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cert", "\\u", "path_", "=_", "options_", "._", "get_", "(_", "\"", "cert", "\\u", "path", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "quit", "\\u", "command_", "=_", "(_", "sys_", "._", "platform_", "==_", "'", "win32", "'_", ")_", "and_", "'", "CTR", "L", "-", "BREAK", "'_", "or_", "'", "CONTR", "OL", "-", "C", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bind", "\\u", "url_", "=_", "\"", "http", "://", "%", "s", ":", "%", "s", "/\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "addr_", "if_", "not_", "self_", "._", "\\u", "raw", "\\u", "ipv6_", "else_", "'[", "%", "s", "]'_", "%_", "self_", "._", "addr_", ",_", "self_", "._", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra", "\\u", "files_", "=_", "options_", "._", "get_", "(_", "'", "extra", "\\u", "files", "'_", ",_", "None_", ")_", "or_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reloade", "r", "\\u", "interval_", "=_", "options_", "._", "get_", "(_", "'", "reloade", "r", "\\u", "interval", "'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "inner", "\\u", "run_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "show", "\\u", "start", "up", "\\u", "messages_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Perform", "ing", " ", "system", " ", "checks", "...", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "self_", ",_", "'", "check", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "check_", "(_", "display", "\\u", "num", "\\u", "errors_", "=_", "self_", "._", "show", "\\u", "start", "up", "\\u", "messages_", ")_", "\\u\\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_", "._", "validate_", "(_", "display", "\\u", "num", "\\u", "errors_", "=_", "self_", "._", "show", "\\u", "start", "up", "\\u", "messages_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "HAS", "\\u", "MIGRAT", "IONS", "_", ":_", "\\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_", "._", "check", "\\u", "migrations_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Impro", "perl", "y", "Configured_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "show", "\\u", "start", "up", "\\u", "messages_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"\\\\", "n", "Dj", "ang", "o", " ", "version", " ", "%", "s", ",", " ", "usi", "ng", " ", "settings", " ", "%", "r", "\"_", "%_", "(_", "django_", "._", "get", "\\u", "version_", "(_", ")_", ",_", "settings_", "._", "SETTING", "S", "\\u", "MODULE_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Dev", "elo", "pme", "nt", " ", "server", " ", "is", " ", "runn", "ing", " ", "at", " ", "%", "s", "\"_", "%_", "(_", "bind", "\\u", "url_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Us", "ing", " ", "the", " ", "Wer", "kz", "eu", "g", " ", "debugg", "er", " ", "(", "http", "://", "werk", "zeu", "g", ".", "poc", "oo", ".", "org", "/)", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Qui", "t", " ", "the", " ", "server", " ", "with", " ", "%", "s", ".\"_", "%_", "quit", "\\u", "command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "path_", "=_", "options_", "._", "get_", "(_", "'", "admin", "\\u", "media", "\\u", "path", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "admin", "\\u", "media", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "django_", "._", "\\u\\u", "path\\u\\u_", "[_", "0_", "]_", ",_", "'", "contrib", "/", "admin", "/", "static", "/", "admin", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "admin", "\\u", "media", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "path_", "=_", "admin", "\\u", "media", "\\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 ", " ", "_", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "django_", "._", "\\u\\u", "path\\u\\u_", "[_", "0_", "]_", ",_", "'", "contrib", "/", "admin", "/", "media", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "handler_", "=_", "WS", "GI", "Handler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "USE", "\\u", "ADM", "IN", "MEDIA", "HANDLER", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "handler_", "=_", "Admi", "n", "Media", "Handler_", "(_", "handler_", ",_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "USE", "\\u", "STATI", "CF", "ILE", "S_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "use", "\\u", "static", "\\u", "handler_", "=_", "options_", "._", "get_", "(_", "'", "use", "\\u", "static", "\\u", "handler", "'_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "insecure", "\\u", "serving", "_", "=_", "options_", "._", "get_", "(_", "'", "insecure", "\\u", "serving", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "use", "\\u", "static", "\\u", "handler_", "and_", "(_", "settings_", "._", "DEBUG_", "or_", "insecure", "\\u", "serving", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "handler_", "=_", "Static", "Files", "Handler_", "(_", "handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "open", "\\u", "browser_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "webbrowser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "webbrowser_", "._", "open_", "(_", "bind", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cert", "\\u", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Open", "SS", "L", " ", "is", " ", "need", "ed", " ", "for", " ", "SS", "L", " ", "support", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "will", " ", "make", " ", "flake", "s", "8", " ", "throw", " ", "warn", "ing", " ", "sinc", "e", " ", "Open", "SS", "L", " ", "is", " ", "not", " ", "used", "\\", "10", ";", " ", " ", " ", " ", "direct", "ly", ",", " ", "ala", "s", ",", " ", "this", " ", "is", " ", "the", " ", "only", " ", "way", " ", "to", " ", "show", " ", "meaning", "ful", " ", "error", "\\", "10", ";", " ", " ", " ", " ", "message", "s", ".", " ", "See", ":", "\\", "10", ";", " ", " ", " ", " ", "http", "://", "luc", "um", "r", ".", "poc", "oo", ".", "org", "/", "2011", "/", "9", "/", "21", "/", "python", "-", "import", "-", "blackbo", "x", "/", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "more", " ", "informati", "on", " ", "on", " ", "python", " ", "import", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "import_", "Open", "SSL_", "#", " ", "NO", "QA", "_", "\\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 ", " ", "_", "raise_", "Command", "Error_", "(_", "\"", "Pyth", "on", " ", "Open", "SS", "L", " ", "Libr", "ary", " ", "is", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "require", "d", " ", "to", " ", "use", " ", "runs", "erver", "\\u", "plus", " ", "with", " ", "ssl", " ", "support", ".", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Install", " ", "via", " ", "pip", " ", "(", "pip", " ", "install", " ", "py", "Open", "SS", "L", ").\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dir\\u", "path_", ",_", "cert", "\\u", "file_", "=_", "os_", "._", "path_", "._", "split_", "(_", "cert", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "dir\\u", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "dir\\u", "path_", "=_", "os_", "._", "getcwd_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "root_", ",_", "ext_", "=_", "os_", "._", "path_", "._", "splitext_", "(_", "cert", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "certfile", "_", "=_", "os_", "._", "path_", "._", "join_", "(_", "dir\\u", "path_", ",_", "root_", "+_", "\".", "crt", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keyfile_", "=_", "os_", "._", "path_", "._", "join_", "(_", "dir\\u", "path_", ",_", "root_", "+_", "\".", "key", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "from_", "werkzeug_", "._", "serving", "_", "import_", "make", "\\u", "ssl", "\\u", "dev", "cert_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "certfile", "_", ")_", "and_", "os_", "._", "path_", "._", "exists_", "(_", "keyfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "ssl", "\\u", "context_", "=_", "(_", "certfile", "_", ",_", "keyfile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "Creat", "e", " ", "cert", ",", " ", "key", " ", "files", " ", "ours", "elv", "es", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "ssl", "\\u", "context_", "=_", "make", "\\u", "ssl", "\\u", "dev", "cert_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "join_", "(_", "dir\\u", "path_", ",_", "root_", ")_", ",_", "host_", "=_", "'", "local", "host", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "self_", "._", "show", "\\u", "start", "up", "\\u", "messages_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "(_", "\"", "Wer", "kz", "eu", "g", " ", "version", " ", "is", " ", "less", " ", "than", " ", "0.", "9", ",", " ", "try", "ing", " ", "adh", "oc", " ", "certifica", "te", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ssl", "\\u", "context_", "=_", "\"", "adh", "oc", "\"_", "\\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 ", " _", "ssl", "\\u", "context_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "use", "\\u", "reloade", "r_", "and_", "settings_", "._", "USE", "\\u", "I1", "8", "N_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "from_", "django_", "._", "utils_", "._", "autore", "load_", "import_", "gen", "\\u", "filenames_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "extra", "\\u", "files_", "._", "extend_", "(_", "filter_", "(_", "lambda_", "filename_", ":_", "filename_", "._", "endswith_", "(_", "'.", "mo", "'_", ")_", ",_", "gen", "\\u", "filenames_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "run", "\\u", "simple_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "addr_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "int_", "(_", "self_", "._", "port_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Deb", "ugg", "ed", "Application_", "(_", "handler_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "use", "\\u", "reloade", "r_", "=_", "use", "\\u", "reloade", "r_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "use", "\\u", "debugger_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extra", "\\u", "files_", "=_", "extra", "\\u", "files_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reloade", "r", "\\u", "interval_", "=_", "reloade", "r", "\\u", "interval_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "threaded", "_", "=_", "threaded", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ssl", "\\u", "context_", "=_", "ssl", "\\u", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "inner", "\\u", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Module is imported more than once
amrdraz/kodr/app/brython/www/src/Lib/uuid.py
[ { "content": "r\"\"\"UUID objects (universally unique identifiers) according to RFC 4122.\n\nThis module provides immutable UUID objects (class UUID) and the functions\nuuid1(), uuid3(), uuid4(), uuid5() for generating version 1, 3, 4, and 5\nUUIDs as specified in RFC 4122.\n\nIf all you want is a unique ID, you should probably call uuid1() or uuid4().\nNote that uuid1() may compromise privacy since it creates a UUID containing\nthe computer's network address. uuid4() creates a random UUID.\n\nTypical usage:\n\n >>> import uuid\n\n # make a UUID based on the host ID and current time\n >>> uuid.uuid1() # doctest: +SKIP\n UUID('a8098c1a-f86e-11da-bd1a-00112444be1e')\n\n # make a UUID using an MD5 hash of a namespace UUID and a name\n >>> uuid.uuid3(uuid.NAMESPACE_DNS, 'python.org')\n UUID('6fa459ea-ee8a-3ca4-894e-db77e160355e')\n\n # make a random UUID\n >>> uuid.uuid4() # doctest: +SKIP\n UUID('16fd2706-8baf-433b-82eb-8c7fada847da')\n\n # make a UUID using a SHA-1 hash of a namespace UUID and a name\n >>> uuid.uuid5(uuid.NAMESPACE_DNS, 'python.org')\n UUID('886313e1-3b8a-5372-9b90-0c9aee199e5d')\n\n # make a UUID from a string of hex digits (braces and hyphens ignored)\n >>> x = uuid.UUID('{00010203-0405-0607-0809-0a0b0c0d0e0f}')\n\n # convert a UUID to a string of hex digits in standard form\n >>> str(x)\n '00010203-0405-0607-0809-0a0b0c0d0e0f'\n\n # get the raw 16 bytes of the UUID\n >>> x.bytes\n b'\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\t\\n\\x0b\\x0c\\r\\x0e\\x0f'\n\n # make a UUID from a 16-byte string\n >>> uuid.UUID(bytes=x.bytes)\n UUID('00010203-0405-0607-0809-0a0b0c0d0e0f')\n\"\"\"\n\n__author__ = 'Ka-Ping Yee <[email protected]>'\n\nRESERVED_NCS, RFC_4122, RESERVED_MICROSOFT, RESERVED_FUTURE = [\n 'reserved for NCS compatibility', 'specified in RFC 4122',\n 'reserved for Microsoft compatibility', 'reserved for future definition']\n\nint_ = int # The built-in int type\nbytes_ = bytes # The built-in bytes type\n\n\n\n\n\n\n# Thanks to Thomas Heller for ctypes and for his help with its use here.\n\n# If ctypes is available, use it to find system routines for UUID generation.\n# XXX This makes the module non-thread-safe!\n_uuid_generate_random = _uuid_generate_time = _UuidCreate = None\ntry:\n import ctypes, ctypes.util\n\n # The uuid_generate_* routines are provided by libuuid on at least\n # Linux and FreeBSD, and provided by libc on Mac OS X.\n for libname in ['uuid', 'c']:\n try:\n lib = ctypes.CDLL(ctypes.util.find_library(libname))\n except:\n continue\n if hasattr(lib, 'uuid_generate_random'):\n _uuid_generate_random = lib.uuid_generate_random\n if hasattr(lib, 'uuid_generate_time'):\n _uuid_generate_time = lib.uuid_generate_time\n if _uuid_generate_random is not None:\n break # found everything we were looking for\n\n # The uuid_generate_* functions are broken on MacOS X 10.5, as noted\n # in issue #8621 the function generates the same sequence of values\n # in the parent process and all children created using fork (unless\n # those children use exec as well).\n #\n # Assume that the uuid_generate functions are broken from 10.5 onward,\n # the test can be adjusted when a later version is fixed.\n import sys\n if sys.platform == 'darwin':\n import os\n if int(os.uname().release.split('.')[0]) >= 9:\n _uuid_generate_random = _uuid_generate_time = None\n\n # On Windows prior to 2000, UuidCreate gives a UUID containing the\n # hardware address. On Windows 2000 and later, UuidCreate makes a\n # random UUID and UuidCreateSequential gives a UUID containing the\n # hardware address. These routines are provided by the RPC runtime.\n # NOTE: at least on Tim's WinXP Pro SP2 desktop box, while the last\n # 6 bytes returned by UuidCreateSequential are fixed, they don't appear\n # to bear any relationship to the MAC address of any network device\n # on the box.\n try:\n lib = ctypes.windll.rpcrt4\n except:\n lib = None\n _UuidCreate = getattr(lib, 'UuidCreateSequential',\n getattr(lib, 'UuidCreate', None))\nexcept:\n pass\n\n\n\n\n_node = None\n\n\n_last_timestamp = None\n\n\n\n\n\n# The following standard UUIDs are for use with uuid3() or uuid5().\n\nNAMESPACE_DNS = UUID('6ba7b810-9dad-11d1-80b4-00c04fd430c8')\nNAMESPACE_URL = UUID('6ba7b811-9dad-11d1-80b4-00c04fd430c8')\nNAMESPACE_OID = UUID('6ba7b812-9dad-11d1-80b4-00c04fd430c8')\nNAMESPACE_X500 = UUID('6ba7b814-9dad-11d1-80b4-00c04fd430c8')\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def _find_mac(command, args, hw_identifiers, get_index):\n import os, shutil\n executable = shutil.which(command)\n if executable is None:\n path = os.pathsep.join(('/sbin', '/usr/sbin'))\n executable = shutil.which(command, path=path)\n if executable is None:\n return None\n\n try:\n # LC_ALL to ensure English output, 2>/dev/null to prevent output on\n # stderr (Note: we don't have an example where the words we search for\n # are actually localized, but in theory some system could do so.)\n cmd = 'LC_ALL=C %s %s 2>/dev/null' % (executable, args)\n with os.popen(cmd) as pipe:\n for line in pipe:\n words = line.lower().split()\n for i in range(len(words)):\n if words[i] in hw_identifiers:\n try:\n return int(\n words[get_index(i)].replace(':', ''), 16)\n except (ValueError, IndexError):\n # Virtual interfaces, such as those provided by\n # VPNs, do not have a colon-delimited MAC address\n # as expected, but a 16-byte HWAddr separated by\n # dashes. These should be ignored in favor of a\n # real MAC address\n pass\n except OSError:\n pass", "metadata": "root._find_mac", "header": "['module', '___EOS___']", "index": 313 }, { "content": "def _ipconfig_getnode():\n \"\"\"Get the hardware address on Windows by running ipconfig.exe.\"\"\"\n import os, re\n dirs = ['', r'c:\\windows\\system32', r'c:\\winnt\\system32']\n try:\n import ctypes\n buffer = ctypes.create_string_buffer(300)\n ctypes.windll.kernel32.GetSystemDirectoryA(buffer, 300)\n dirs.insert(0, buffer.value.decode('mbcs'))\n except:\n pass\n #for dir in dirs:\n #try:\n # pipe = os.popen(os.path.join(dir, 'ipconfig') + ' /all')\n #except OSError:\n # continue\n #else:\n # for line in pipe:\n # value = line.split(':')[-1].strip().lower()\n # if re.match('([0-9a-f][0-9a-f]-){5}[0-9a-f][0-9a-f]', value):\n # return int(value.replace('-', ''), 16)\n #finally:\n # pipe.close()", "metadata": "root._ipconfig_getnode", "header": "['module', '___EOS___']", "index": 369 }, { "content": "def uuid4():\n \"\"\"Generate a random UUID.\"\"\"\n\n # When the system provides a version-4 UUID generator, use it.\n if _uuid_generate_random:\n _buffer = ctypes.create_string_buffer(16)\n _uuid_generate_random(_buffer)\n return UUID(bytes=bytes_(_buffer.raw))\n\n # Otherwise, get randomness from urandom or the 'random' module.\n try:\n import os\n return UUID(bytes=os.urandom(16), version=4)\n except:\n import random\n bytes = bytes_(random.randrange(256) for i in range(16))\n return UUID(bytes=bytes, version=4)", "metadata": "root.uuid4", "header": "['module', '___EOS___']", "index": 563 } ]
[ { "span": "import os, shutil", "start_line": 314, "start_column": 4, "end_line": 314, "end_column": 21 }, { "span": "import os, re", "start_line": 371, "start_column": 4, "end_line": 371, "end_column": 17 }, { "span": "import ctypes", "start_line": 374, "start_column": 8, "end_line": 374, "end_column": 21 }, { "span": "import os", "start_line": 574, "start_column": 8, "end_line": 574, "end_column": 17 } ]
[ { "span": "import ctypes, ctypes.util", "start_line": 428, "start_column": 4, "end_line": 428, "end_column": 30 }, { "span": "import os", "start_line": 453, "start_column": 8, "end_line": 453, "end_column": 17 } ]
1
true
[ "[CLS]_", "Module_", "is_", "imported_", "more_", "than_", "once_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "r", "\"\"\"", "UU", "ID", " ", "object", "s", " ", "(", "universal", "ly", " ", "unique", " ", "identifi", "ers", ")", " ", "according", " ", "to", " ", "RF", "C", " ", "412", "2", ".", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "module", " ", "provide", "s", " ", "immutable", " ", "UU", "ID", " ", "object", "s", " ", "(", "class", " ", "UU", "ID", ")", " ", "and", " ", "the", " ", "function", "s", "\\", "10", ";", "uuid", "1", "()", ",", " ", "uuid", "3", "()", ",", " ", "uuid", "4", "()", ",", " ", "uuid", "5", "()", " ", "for", " ", "generat", "ing", " ", "version", " ", "1", ",", " ", "3", ",", " ", "4", ",", " ", "and", " ", "5", "\\", "10", ";", "UU", "ID", "s", " ", "as", " ", "specified", " ", "in", " ", "RF", "C", " ", "412", "2", ".", "\\", "10", ";", "\\", "10", ";", "If", " ", "all", " ", "you", " ", "want", " ", "is", " ", "a", " ", "unique", " ", "ID", ",", " ", "you", " ", "shou", "ld", " ", "probab", "ly", " ", "call", " ", "uuid", "1", "()", " ", "or", " ", "uuid", "4", "()", ".", "\\", "10", ";", "Not", "e", " ", "tha", "t", " ", "uuid", "1", "()", " ", "may", " ", "compr", "omi", "se", " ", "privacy", " ", "sinc", "e", " ", "it", " ", "create", "s", " ", "a", " ", "UU", "ID", " ", "contain", "ing", "\\", "10", ";", "the", " ", "computer", "'", "s", " ", "network", " ", "address", ".", " ", " ", "uuid", "4", "()", " ", "create", "s", " ", "a", " ", "random", " ", "UU", "ID", ".", "\\", "10", ";", "\\", "10", ";", "Typical", " ", "usage", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "import", " ", "uuid", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "make", " ", "a", " ", "UU", "ID", " ", "based", " ", "on", " ", "the", " ", "host", " ", "ID", " ", "and", " ", "current", " ", "time", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "uuid", ".", "uuid", "1", "()", " ", " ", " ", " ", "#", " ", "docte", "st", ":", " ", "+", "SKIP", "\\", "10", ";", " ", " ", " ", " ", "UU", "ID", "('", "a8", "098", "c1", "a", "-", "f8", "6e", "-1", "1d", "a", "-", "bd", "1a", "-0", "011", "244", "4b", "e1", "e", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "make", " ", "a", " ", "UU", "ID", " ", "usi", "ng", " ", "an", " ", "MD", "5", " ", "hash", " ", "of", " ", "a", " ", "namespace", " ", "UU", "ID", " ", "and", " ", "a", " ", "name", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "uuid", ".", "uuid", "3", "(", "uuid", ".", "NAMESPACE", "\\u", "DNS", ",", " ", "'", "python", ".", "org", "')", "\\", "10", ";", " ", " ", " ", " ", "UU", "ID", "('", "6f", "a4", "5", "9e", "a", "-", "ee", "8a", "-", "3c", "a4", "-", "894", "e-", "db", "7", "7e", "160", "355", "e", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "make", " ", "a", " ", "random", " ", "UU", "ID", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "uuid", ".", "uuid", "4", "()", " ", " ", " ", " ", "#", " ", "docte", "st", ":", " ", "+", "SKIP", "\\", "10", ";", " ", " ", " ", " ", "UU", "ID", "('", "16", "fd", "270", "6", "-", "8b", "af", "-", "433", "b", "-", "8", "2e", "b", "-", "8c", "7f", "ada", "847", "da", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "make", " ", "a", " ", "UU", "ID", " ", "usi", "ng", " ", "a", " ", "SHA", "-1", " ", "hash", " ", "of", " ", "a", " ", "namespace", " ", "UU", "ID", " ", "and", " ", "a", " ", "name", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "uuid", ".", "uuid", "5", "(", "uuid", ".", "NAMESPACE", "\\u", "DNS", ",", " ", "'", "python", ".", "org", "')", "\\", "10", ";", " ", " ", " ", " ", "UU", "ID", "('", "886", "313", "e1", "-", "3b", "8a", "-", "537", "2", "-", "9", "b9", "0", "-0", "c9", "ae", "e1", "9", "9e", "5d", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "make", " ", "a", " ", "UU", "ID", " ", "from", " ", "a", " ", "string", " ", "of", " ", "hex", " ", "digit", "s", " ", "(", "braces", " ", "and", " ", "hyphen", "s", " ", "ignore", "d", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "x", " ", "=", " ", "uuid", ".", "UU", "ID", "('{", "00010", "203", "-0", "405", "-0", "607", "-0", "809", "-0", "a0", "b0", "c0", "d0", "e0", "f", "}')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "convert", " ", "a", " ", "UU", "ID", " ", "to", " ", "a", " ", "string", " ", "of", " ", "hex", " ", "digit", "s", " ", "in", " ", "standard", " ", "form", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "str", "(", "x", ")", "\\", "10", ";", " ", " ", " ", " ", "'", "00010", "203", "-0", "405", "-0", "607", "-0", "809", "-0", "a0", "b0", "c0", "d0", "e0", "f", "'", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "get", " ", "the", " ", "raw", " ", "16", " ", "bytes", " ", "of", " ", "the", " ", "UU", "ID", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "x", ".", "bytes", "\\", "10", ";", " ", " ", " ", " ", "b", "'\\\\", "x0", "0", "\\\\", "x0", "1", "\\\\", "x0", "2", "\\\\", "x0", "3", "\\\\", "x0", "4", "\\\\", "x0", "5", "\\\\", "x0", "6", "\\\\", "x0", "7", "\\\\", "x0", "8", "\\\\", "t", "\\\\", "n", "\\\\", "x0", "b", "\\\\", "x0", "c", "\\\\", "r", "\\\\", "x0", "e", "\\\\", "x0", "f", "'", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "make", " ", "a", " ", "UU", "ID", " ", "from", " ", "a", " ", "16", "-", "byte", " ", "string", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "uuid", ".", "UU", "ID", "(", "bytes", "=", "x", ".", "bytes", ")", "\\", "10", ";", " ", " ", " ", " ", "UU", "ID", "('", "00010", "203", "-0", "405", "-0", "607", "-0", "809", "-0", "a0", "b0", "c0", "d0", "e0", "f", "')", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "author\\u\\u_", "=_", "'", "Ka", "-", "Ping", " ", "Ye", "e", " ", "<", "ping", "@", "zes", "ty", ".", "ca", ">'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "RESERVED", "\\u", "NC", "S_", ",_", "RF", "C", "\\u", "412", "2_", ",_", "RESERVED", "\\u", "MICRO", "SOFT", "_", ",_", "RESERVED", "\\u", "FUT", "URE_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reserve", "d", " ", "for", " ", "NC", "S", " ", "compatibility", "'_", ",_", "'", "specified", " ", "in", " ", "RF", "C", " ", "412", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reserve", "d", " ", "for", " ", "Micro", "soft", " ", "compatibility", "'_", ",_", "'", "reserve", "d", " ", "for", " ", "future", " ", "definit", "ion", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "int\\u", "_", "=_", "int_", "#", " ", "The", " ", "bui", "lt", "-", "in", " ", "int", " ", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bytes", "\\u_", "=_", "bytes_", "#", " ", "The", " ", "bui", "lt", "-", "in", " ", "bytes", " ", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "#", " ", "Thanks", " ", "to", " ", "Tho", "mas", " ", "Hell", "er", " ", "for", " ", "ctype", "s", " ", "and", " ", "for", " ", "his", " ", "help", " ", "with", " ", "its", " ", "use", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "ctype", "s", " ", "is", " ", "avail", "able", ",", " ", "use", " ", "it", " ", "to", " ", "find", " ", "system", " ", "routin", "es", " ", "for", " ", "UU", "ID", " ", "generat", "ion", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "XX", "X", " ", "Thi", "s", " ", "make", "s", " ", "the", " ", "module", " ", "non", "-", "thread", "-", "safe", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "uuid", "\\u", "generat", "e\\u", "random_", "=_", "\\u", "uuid", "\\u", "generat", "e\\u", "time_", "=_", "\\u", "Uu", "id", "Create_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "ctypes_", ",_", "ctypes_", "._", "util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "uuid", "\\u", "generat", "e\\u", "*", " ", "routin", "es", " ", "are", " ", "provided", " ", "by", " ", "lib", "uuid", " ", "on", " ", "at", " ", "leas", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Lin", "ux", " ", "and", " ", "Free", "BS", "D", ",", " ", "and", " ", "provided", " ", "by", " ", "libc", " ", "on", " ", "Mac", " ", "OS", " ", "X", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "libname", "_", "in_", "[_", "'", "uuid", "'_", ",_", "'", "c", "'_", "]_", ":_", "\\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 ", " _", "lib_", "=_", "ctypes_", "._", "CD", "LL_", "(_", "ctypes_", "._", "util_", "._", "find", "\\u", "library_", "(_", "libname", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "lib_", ",_", "'", "uuid", "\\u", "generat", "e\\u", "random", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "uuid", "\\u", "generat", "e\\u", "random_", "=_", "lib_", "._", "uuid", "\\u", "generat", "e\\u", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "lib_", ",_", "'", "uuid", "\\u", "generat", "e\\u", "time", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "uuid", "\\u", "generat", "e\\u", "time_", "=_", "lib_", "._", "uuid", "\\u", "generat", "e\\u", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "uuid", "\\u", "generat", "e\\u", "random_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "#", " ", "found", " ", "every", "thing", " ", "we", " ", "wer", "e", " ", "look", "ing", " ", "for_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "uuid", "\\u", "generat", "e\\u", "*", " ", "function", "s", " ", "are", " ", "broken", " ", "on", " ", "Mac", "OS", " ", "X", " ", "10.5", ",", " ", "as", " ", "note", "d_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "issue", " ", "#", "862", "1", " ", "the", " ", "function", " ", "generat", "es", " ", "the", " ", "same", " ", "sequence", " ", "of", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "the", " ", "parent", " ", "process", " ", "and", " ", "all", " ", "child", "ren", " ", "created", " ", "usi", "ng", " ", "fork", " ", "(", "unl", "ess_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tho", "se", " ", "child", "ren", " ", "use", " ", "exec", " ", "as", " ", "well", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Assume", " ", "tha", "t", " ", "the", " ", "uuid", "\\u", "generat", "e", " ", "function", "s", " ", "are", " ", "broken", " ", "from", " ", "10.5", " ", "on", "ward", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "test", " ", "can", " ", "be", " ", "adjusted", " ", "whe", "n", " ", "a", " ", "late", "r", " ", "version", " ", "is", " ", "fixed", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sys_", "._", "platform_", "==_", "'", "dar", "win", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "int_", "(_", "os_", "._", "uname_", "(_", ")_", "._", "release_", "._", "split_", "(_", "'.'_", ")_", "[_", "0_", "]_", ")_", ">=_", "9_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "uuid", "\\u", "generat", "e\\u", "random_", "=_", "\\u", "uuid", "\\u", "generat", "e\\u", "time_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "On", " ", "Window", "s", " ", "prior", " ", "to", " ", "2000", ",", " ", "Uu", "id", "Creat", "e", " ", "give", "s", " ", "a", " ", "UU", "ID", " ", "contain", "ing", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "hard", "ware", " ", "address", ".", " ", " ", "On", " ", "Window", "s", " ", "2000", " ", "and", " ", "late", "r", ",", " ", "Uu", "id", "Creat", "e", " ", "make", "s", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "random", " ", "UU", "ID", " ", "and", " ", "Uu", "id", "Creat", "e", "Sequ", "ential", " ", "give", "s", " ", "a", " ", "UU", "ID", " ", "contain", "ing", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "hard", "ware", " ", "address", ".", " ", " ", "The", "se", " ", "routin", "es", " ", "are", " ", "provided", " ", "by", " ", "the", " ", "RP", "C", " ", "runt", "ime", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NOTE", ":", " ", " ", "at", " ", "leas", "t", " ", "on", " ", "Tim", "'", "s", " ", "Win", "XP", " ", "Pro", " ", "SP", "2", " ", "desk", "top", " ", "box", ",", " ", "whi", "le", " ", "the", " ", "last_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "6", " ", "bytes", " ", "return", "ed", " ", "by", " ", "Uu", "id", "Creat", "e", "Sequ", "ential", " ", "are", " ", "fixed", ",", " ", "the", "y", " ", "don", "'", "t", " ", "appear", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "bear", " ", "any", " ", "relation", "ship", " ", "to", " ", "the", " ", "MAC", " ", "address", " ", "of", " ", "any", " ", "network", " ", "device_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "on", " ", "the", " ", "box", "._", "\\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 ", " _", "lib_", "=_", "ctypes_", "._", "windll_", "._", "rpc", "rt", "4_", "\\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 ", " _", "lib_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "Uu", "id", "Create_", "=_", "getattr_", "(_", "lib_", ",_", "'", "Uu", "id", "Creat", "e", "Sequ", "ential", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "getattr_", "(_", "lib_", ",_", "'", "Uu", "id", "Creat", "e", "'_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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", "node_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "last", "\\u", "timestamp_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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", " ", "standard", " ", "UU", "ID", "s", " ", "are", " ", "for", " ", "use", " ", "with", " ", "uuid", "3", "()", " ", "or", " ", "uuid", "5", "()", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "NAMESPACE", "\\u", "DNS", "_", "=_", "UUID_", "(_", "'", "6b", "a7", "b8", "10", "-", "9", "dad", "-1", "1d", "1", "-", "80", "b4", "-0", "0c", "04", "fd", "430", "c8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "NAMESPACE", "\\u", "URL_", "=_", "UUID_", "(_", "'", "6b", "a7", "b8", "11", "-", "9", "dad", "-1", "1d", "1", "-", "80", "b4", "-0", "0c", "04", "fd", "430", "c8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "NAMESPACE", "\\u", "OID_", "=_", "UUID_", "(_", "'", "6b", "a7", "b8", "1", "2", "-", "9", "dad", "-1", "1d", "1", "-", "80", "b4", "-0", "0c", "04", "fd", "430", "c8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "NAMESPACE", "\\u", "X", "500_", "=_", "UUID_", "(_", "'", "6b", "a7", "b8", "14", "-", "9", "dad", "-1", "1d", "1", "-", "80", "b4", "-0", "0c", "04", "fd", "430", "c8", "'_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "find", "\\u", "mac_", "(_", "command_", ",_", "args_", ",_", "hw", "\\u", "identifiers_", ",_", "get", "\\u", "index_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "os_", ",_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "executable_", "=_", "shutil_", "._", "which_", "(_", "command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "executable_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", "=_", "os_", "._", "pathsep_", "._", "join_", "(_", "(_", "'/", "sb", "in", "'_", ",_", "'/", "usr", "/", "sb", "in", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "executable_", "=_", "shutil_", "._", "which_", "(_", "command_", ",_", "path_", "=_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "executable_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "LC", "\\u", "ALL", " ", "to", " ", "ensure", " ", "Eng", "lish", " ", "output", ",", " ", "2", ">/", "dev", "/", "null", " ", "to", " ", "prevent", " ", "output", " ", "on_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "std", "err", " ", "(", "Not", "e", ":", " ", "we", " ", "don", "'", "t", " ", "have", " ", "an", " ", "example", " ", "where", " ", "the", " ", "words", " ", "we", " ", "search", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "are", " ", "actual", "ly", " ", "localized", ",", " ", "but", " ", "in", " ", "theory", " ", "some", " ", "system", " ", "coul", "d", " ", "do", " ", "so", ".)", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cmd_", "=_", "'", "LC", "\\u", "ALL", "=", "C", " ", "%", "s", " ", "%", "s", " ", "2", ">/", "dev", "/", "null", "'_", "%_", "(_", "executable_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "os_", "._", "popen_", "(_", "cmd_", ")_", "as_", "pipe_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "line_", "in_", "pipe_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "words_", "=_", "line_", "._", "lower_", "(_", ")_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "words_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "words_", "[_", "i_", "]_", "in_", "hw", "\\u", "identifiers_", ":_", "\\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_", "int_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "words_", "[_", "get", "\\u", "index_", "(_", "i_", ")_", "]_", "._", "replace_", "(_", "':'_", ",_", "''_", ")_", ",_", "16_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Value", "Error_", ",_", "Index", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Virt", "ual", " ", "interface", "s", ",", " ", "suc", "h", " ", "as", " ", "tho", "se", " ", "provided", " ", "by_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "VP", "Ns", ",", " ", "do", " ", "not", " ", "have", " ", "a", " ", "colon", "-", "delim", "ited", " ", "MAC", " ", "address_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "as", " ", "expected", ",", " ", "but", " ", "a", " ", "16", "-", "byte", " ", "HW", "Add", "r", " ", "separate", "d", " ", "by_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dashes", ".", " ", "The", "se", " ", "shou", "ld", " ", "be", " ", "ignore", "d", " ", "in", " ", "fav", "or", " ", "of", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "real", " ", "MAC", " ", "address_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "ipc", "onfi", "g", "\\u", "getn", "ode_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "the", " ", "hard", "ware", " ", "address", " ", "on", " ", "Window", "s", " ", "by", " ", "runn", "ing", " ", "ipc", "onfi", "g", ".", "exe", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", ",_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dirs_", "=_", "[_", "''_", ",_", "r", "'", "c", ":\\\\", "windows", "\\\\", "system", "32", "'_", ",_", "r", "'", "c", ":\\\\", "win", "nt", "\\\\", "system", "32", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "ctypes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "buffer_", "=_", "ctypes_", "._", "create", "\\u", "string", "\\u", "buffer_", "(_", "300_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctypes_", "._", "windll_", "._", "kernel32_", "._", "Get", "System", "Director", "y", "A_", "(_", "buffer_", ",_", "300_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dirs_", "._", "insert_", "(_", "0_", ",_", "buffer_", "._", "value_", "._", "decode_", "(_", "'", "mb", "cs", "'_", ")_", ")_", "\\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_", "#", "for", " ", "dir", " ", "in", " ", "dirs", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "try", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "pipe", " ", "=", " ", "os", ".", "popen", "(", "os", ".", "path", ".", "join", "(", "dir", ",", " ", "'", "ipc", "onfi", "g", "')", " ", "+", " ", "'", " ", "/", "all", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "except", " ", "OSE", "rror", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "continue_", "\\u\\u\\uNL\\u\\u\\u_", "#", "else", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "for", " ", "line", " ", "in", " ", "pipe", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "value", " ", "=", " ", "line", ".", "split", "('", ":'", ")[", "-1", "].", "strip", "()", ".", "lower", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "if", " ", "re", ".", "match", "('", "([", "0", "-", "9", "a", "-", "f", "][", "0", "-", "9", "a", "-", "f", "]-", "){", "5", "}[", "0", "-", "9", "a", "-", "f", "][", "0", "-", "9", "a", "-", "f", "]'", ",", " ", "value", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "return", " ", "int", "(", "value", ".", "replace", "('", "-'", ",", " ", "''", "),", " ", "16", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "final", "ly", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "pipe", ".", "close", "()", "_", "\\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_", "def_", "uuid4_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Generate", " ", "a", " ", "random", " ", "UU", "ID", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Whe", "n", " ", "the", " ", "system", " ", "provide", "s", " ", "a", " ", "version", "-", "4", " ", "UU", "ID", " ", "generat", "or", ",", " ", "use", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u", "uuid", "\\u", "generat", "e\\u", "random_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "buffer_", "=_", "ctypes_", "._", "create", "\\u", "string", "\\u", "buffer_", "(_", "16_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "uuid", "\\u", "generat", "e\\u", "random_", "(_", "\\u", "buffer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "UUID_", "(_", "bytes_", "=_", "bytes", "\\u_", "(_", "\\u", "buffer_", "._", "raw_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ot", "her", "wis", "e", ",", " ", "get", " ", "random", "ness", " ", "from", " ", "uran", "dom", " ", "or", " ", "the", " ", "'", "random", "'", " ", "module", "._", "\\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 ", " _", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "UUID_", "(_", "bytes_", "=_", "os_", "._", "urandom_", "(_", "16_", ")_", ",_", "version_", "=_", "4_", ")_", "\\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 ", " _", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bytes_", "=_", "bytes", "\\u_", "(_", "random_", "._", "randrange_", "(_", "256_", ")_", "for_", "i_", "in_", "range_", "(_", "16_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "UUID_", "(_", "bytes_", "=_", "bytes_", ",_", "version_", "=_", "4_", ")_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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 ]
Unused local variable
Rediker-Software/doac/doac/contrib/rest_framework/authentication.py
[ { "content": " def authenticate(self, request):\n \"\"\"\n Send the request through the authentication middleware that\n is provided with DOAC and grab the user and token from it.\n \"\"\"\n\n from doac.middleware import AuthenticationMiddleware\n\n try:\n response = AuthenticationMiddleware().process_request(request)\n except:\n raise exceptions.AuthenticationFailed(\"Invalid handler\")\n\n if not hasattr(request, \"user\") or not request.user.is_authenticated():\n return None\n\n if not hasattr(request, \"access_token\"):\n raise exceptions.AuthenticationFailed(\"Access token was not valid\")\n\n return request.user, request.access_token", "metadata": "root.DoacAuthentication.authenticate", "header": "['class', 'DoacAuthentication', '(', 'authentication', '.', 'BaseAuthentication', ')', ':', '___EOS___']", "index": 5 } ]
[ { "span": "response ", "start_line": 14, "start_column": 12, "end_line": 14, "end_column": 20 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Do", "ac", "Authentication_", "(_", "authentication_", "._", "Base", "Authentication_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "authenticate_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Sen", "d", " ", "the", " ", "request", " ", "through", " ", "the", " ", "authenticat", "ion", " ", "middle", "ware", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "provided", " ", "with", " ", "DO", "AC", " ", "and", " ", "gra", "b", " ", "the", " ", "user", " ", "and", " ", "token", " ", "from", " ", "it", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "do", "ac_", "._", "middleware_", "import_", "Auth", "entica", "tion", "Middleware_", "\\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_", "=_", "Auth", "entica", "tion", "Middleware_", "(_", ")_", "._", "process", "\\u", "request_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exceptions_", "._", "Auth", "entica", "tion", "Failed_", "(_", "\"", "Inva", "lid", " ", "handler", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "hasattr_", "(_", "request_", ",_", "\"", "user", "\"_", ")_", "or_", "not_", "request_", "._", "user_", "._", "is", "\\u", "authenticated_", "(_", ")_", ":_", "\\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_", "not_", "hasattr_", "(_", "request_", ",_", "\"", "access", "\\u", "token", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exceptions_", "._", "Auth", "entica", "tion", "Failed_", "(_", "\"", "Access", " ", "token", " ", "was", " ", "not", " ", "valid", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "request_", "._", "user_", ",_", "request_", "._", "access", "\\u", "token_", "\\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, 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 ]
Unused import
carpedm20/LINE/line/api.py
[ { "content": "# -*- coding: utf-8 -*-\n\"\"\"\n line.client\n ~~~~~~~~~~~\n\n LineClient for sending and receiving message from LINE server.\n\n :copyright: (c) 2014 by Taehoon Kim.\n :license: BSD, see LICENSE for more details.\n\"\"\"\nimport rsa\nimport requests\ntry:\n import simplejson as json\nexcept ImportError:\n import json\n\nfrom thrift.transport import TTransport\nfrom thrift.transport import TSocket\nfrom thrift.transport import THttpClient\nfrom thrift.protocol import TCompactProtocol\n\nimport sys\nreload(sys)\nsys.setdefaultencoding(\"utf-8\")\n\n#from curve import CurveThrift\nfrom curve import CurveThrift\nfrom curve.ttypes import TalkException\nfrom curve.ttypes import ToType, ContentType\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class LineAPI(object):\n \"\"\"This class is a wrapper of LINE API\n\n \"\"\"\n LINE_DOMAIN = \"http://gd2.line.naver.jp\"\n\n LINE_HTTP_URL = LINE_DOMAIN + \"/api/v4/TalkService.do\"\n LINE_HTTP_IN_URL = LINE_DOMAIN + \"/P4\"\n LINE_CERTIFICATE_URL = LINE_DOMAIN + \"/Q\"\n LINE_SESSION_LINE_URL = LINE_DOMAIN + \"/authct/v1/keys/line\"\n LINE_SESSION_NAVER_URL = LINE_DOMAIN + \"/authct/v1/keys/naver\"\n \n CERT_FILE = \".line.crt\"\n\n ip = \"127.0.0.1\"\n version = \"5.1.2\"\n com_name = \"\"\n revision = 0\n certificate = \"\"\n\n _headers = {}\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", "metadata": "root.LineAPI", "header": "['module', '___EOS___']", "index": 31 }, { "content": " def __init__(self):\n object.__init__(self)\n self._session = requests.session()", "metadata": "root.LineAPI.__init__", "header": "['class', 'LineAPI', '(', 'object', ')', ':', '___EOS___']", "index": 53 }, { "content": " def ready(self):\n \"\"\"\n After login, make `client` and `client_in` instance\n to communicate with LINE server\n \"\"\"\n raise Exception(\"Code is removed because of the request of LINE corporation\")", "metadata": "root.LineAPI.ready", "header": "['class', 'LineAPI', '(', 'object', ')', ':', '___EOS___']", "index": 57 }, { "content": " def updateAuthToken(self):\n \"\"\"\n After login, update authToken to avoid expiration of\n authToken. This method skip the PinCode validation step.\n \"\"\"\n if self.certificate:\n self.login()\n self.tokenLogin()\n\n return True\n else:\n self.raise_error(\"You need to login first. There is no valid certificate\")", "metadata": "root.LineAPI.updateAuthToken", "header": "['class', 'LineAPI', '(', 'object', ')', ':', '___EOS___']", "index": 64 }, { "content": " def tokenLogin(self):\n self.transport = THttpClient.THttpClient(self.LINE_HTTP_URL)\n self.transport.setCustomHeaders(self._headers)\n\n self.protocol = TCompactProtocol.TCompactProtocol(self.transport)\n self._client = CurveThrift.Client(self.protocol)", "metadata": "root.LineAPI.tokenLogin", "header": "['class', 'LineAPI', '(', 'object', ')', ':', '___EOS___']", "index": 77 }, { "content": " def login(self):\n \"\"\"Login to LINE server.\"\"\"\n if self.provider == CurveThrift.Provider.LINE: # LINE\n j = self._get_json(self.LINE_SESSION_LINE_URL)\n else: # NAVER\n j = self._get_json(self.LINE_SESSION_NAVER_URL)\n\n session_key = j['session_key']\n message = (chr(len(session_key)) + session_key +\n chr(len(self.id)) + self.id +\n chr(len(self.password)) + self.password).encode('utf-8')\n\n keyname, n, e = j['rsa_key'].split(\",\")\n pub_key = rsa.PublicKey(int(n,16), int(e,16))\n crypto = rsa.encrypt(message, pub_key).encode('hex')\n\n self.transport = THttpClient.THttpClient(self.LINE_HTTP_URL)\n self.transport.setCustomHeaders(self._headers)\n\n self.protocol = TCompactProtocol.TCompactProtocol(self.transport)\n self._client = CurveThrift.Client(self.protocol)\n\n try:\n with open(self.CERT_FILE,'r') as f:\n self.certificate = f.read()\n f.close()\n except:\n self.certificate = \"\"\n\n msg = self._client.loginWithIdentityCredentialForCertificate(\n self.id, self.password, keyname, crypto, True, self.ip,\n self.com_name, self.provider, self.certificate)\n\n if msg.type == 1:\n self.certificate = msg.certificate\n self.authToken = self._headers['X-Line-Access'] = msg.authToken\n elif msg.type == 2:\n msg = \"require QR code\"\n self.raise_error(msg)\n elif msg.type == 3:\n self._headers['X-Line-Access'] = msg.verifier\n self._pinCode = msg.pinCode\n\n print \"Enter PinCode '%s' to your mobile phone in 2 minutes\"\\\n % self._pinCode\n\n j = self.get_json(self.LINE_CERTIFICATE_URL)\n self.verifier = j['result']['verifier']\n\n msg = self._client.loginWithVerifierForCertificate(self.verifier)\n if msg.type == 1:\n if msg.certificate is not None:\n with open(self.CERT_FILE,'w') as f:\n f.write(msg.certificate)\n self.certificate = msg.certificate\n if msg.authToken is not None:\n self.authToken = self._headers['X-Line-Access'] = msg.authToken\n return True\n else:\n return False\n else:\n msg = \"Require device confirm\"\n self.raise_error(msg)\n\n #raise Exception(\"Code is removed because of the request of LINE corporation\")\n else:\n self.authToken = self._headers['X-Line-Access'] = msg.authToken\n\n return True", "metadata": "root.LineAPI.login", "header": "['class', 'LineAPI', '(', 'object', ')', ':', '___EOS___']", "index": 84 }, { "content": " def get_json(self, url):\n \"\"\"Get josn from given url with saved session and headers\"\"\"\n return json.loads(self._session.get(url, headers=self._headers).text)", "metadata": "root.LineAPI.get_json", "header": "['class', 'LineAPI', '(', 'object', ')', ':', '___EOS___']", "index": 154 }, { "content": " def _getProfile(self):\n \"\"\"Get profile information\n\n :returns: Profile object\n - picturePath\n - displayName\n - phone (base64 encoded?)\n - allowSearchByUserid\n - pictureStatus\n - userid\n - mid # used for unique id for account\n - phoneticName\n - regionCode\n - allowSearchByEmail\n - email\n - statusMessage\n \"\"\"\n return self._client.getProfile()", "metadata": "root.LineAPI._getProfile", "header": "['class', 'LineAPI', '(', 'object', ')', ':', '___EOS___']", "index": 158 }, { "content": " def _getAllContactIds(self):\n \"\"\"Get all contacts of your LINE account\"\"\"\n return self._client.getAllContactIds()", "metadata": "root.LineAPI._getAllContactIds", "header": "['class', 'LineAPI', '(', 'object', ')', ':', '___EOS___']", "index": 177 }, { "content": " def _getBlockedContactIds(self):\n \"\"\"Get all blocked contacts of your LINE account\"\"\"\n return self._client.getBlockedContactIds()", "metadata": "root.LineAPI._getBlockedContactIds", "header": "['class', 'LineAPI', '(', 'object', ')', ':', '___EOS___']", "index": 181 }, { "content": " def _getContacts(self, ids):\n \"\"\"Get contact information list from ids\n\n :returns: List of Contact list\n - status\n - capableVideoCall\n - dispalyName\n - settings\n - pictureStatus\n - capableVoiceCall\n - capableBuddy\n - mid\n - displayNameOverridden\n - relation\n - thumbnailUrl\n - createdTime\n - facoriteTime\n - capableMyhome\n - attributes\n - type\n - phoneticName\n - statusMessage\n \"\"\"\n if type(ids) != list:\n msg = \"argument should be list of contact ids\"\n self.raise_error(msg)\n\n return self._client.getContacts(ids)", "metadata": "root.LineAPI._getContacts", "header": "['class', 'LineAPI', '(', 'object', ')', ':', '___EOS___']", "index": 185 }, { "content": " def _findAndAddContactsByMid(self, mid, seq=0):\n \"\"\"Find and add contacts by Mid\"\"\"\n return self._client.findAndAddContactsByMid(seq, mid)", "metadata": "root.LineAPI._findAndAddContactsByMid", "header": "['class', 'LineAPI', '(', 'object', ')', ':', '___EOS___']", "index": 214 }, { "content": " def _findContactByUserid(self, userid):\n \"\"\"Find contacts by Userid\"\"\"\n return self._client.findContactByUserid(userid)", "metadata": "root.LineAPI._findContactByUserid", "header": "['class', 'LineAPI', '(', 'object', ')', ':', '___EOS___']", "index": 218 }, { "content": " def _findAndAddContactsByUserid(self, userid, seq=0):\n \"\"\"Find and add contacts by Userid\"\"\"\n return self._client.findAndAddContactsByUserid(seq, userid)", "metadata": "root.LineAPI._findAndAddContactsByUserid", "header": "['class', 'LineAPI', '(', 'object', ')', ':', '___EOS___']", "index": 222 }, { "content": " def _findContactsByPhone(self, phones):\n \"\"\"Find contacts by phone\"\"\"\n return self._client.findContactsByPhone(phones)", "metadata": "root.LineAPI._findContactsByPhone", "header": "['class', 'LineAPI', '(', 'object', ')', ':', '___EOS___']", "index": 226 }, { "content": " def _findAndAddContactsByPhone(self, phones, seq=0):\n \"\"\"Find and add contacts by phone\"\"\"\n return self._client.findAndAddContactsByPhone(seq, phones)", "metadata": "root.LineAPI._findAndAddContactsByPhone", "header": "['class', 'LineAPI', '(', 'object', ')', ':', '___EOS___']", "index": 230 }, { "content": " def _findContactsByEmail(self, emails):\n \"\"\"Find contacts by email\"\"\"\n return self._client.findContactsByEmail(emails)", "metadata": "root.LineAPI._findContactsByEmail", "header": "['class', 'LineAPI', '(', 'object', ')', ':', '___EOS___']", "index": 234 }, { "content": " def _findAndAddContactsByEmail(self, emails, seq=0):\n \"\"\"Find and add contacts by email\"\"\"\n return self._client.findAndAddContactsByEmail(seq, emails)", "metadata": "root.LineAPI._findAndAddContactsByEmail", "header": "['class', 'LineAPI', '(', 'object', ')', ':', '___EOS___']", "index": 238 }, { "content": " def _createRoom(self, ids, seq=0):\n \"\"\"Create a chat room\"\"\"\n return self._client.createRoom(seq, ids)", "metadata": "root.LineAPI._createRoom", "header": "['class', 'LineAPI', '(', 'object', ')', ':', '___EOS___']", "index": 242 }, { "content": " def _getRoom(self, id):\n \"\"\"Get a chat room\"\"\"\n return self._client.getRoom(id)", "metadata": "root.LineAPI._getRoom", "header": "['class', 'LineAPI', '(', 'object', ')', ':', '___EOS___']", "index": 246 }, { "content": " def _inviteIntoRoom(self, roomId, contactIds=[]):\n \"\"\"Invite contacts into room\"\"\"\n return self._client.inviteIntoRoom(0, roomId, contactIds)", "metadata": "root.LineAPI._inviteIntoRoom", "header": "['class', 'LineAPI', '(', 'object', ')', ':', '___EOS___']", "index": 250 }, { "content": " def _leaveRoom(self, id):\n \"\"\"Leave a chat room\"\"\"\n return self._client.leaveRoom(0, id)", "metadata": "root.LineAPI._leaveRoom", "header": "['class', 'LineAPI', '(', 'object', ')', ':', '___EOS___']", "index": 254 }, { "content": " def _createGroup(self, name, ids, seq=0):\n \"\"\"Create a group\"\"\"\n return self._client.createGroup(seq, name, ids)", "metadata": "root.LineAPI._createGroup", "header": "['class', 'LineAPI', '(', 'object', ')', ':', '___EOS___']", "index": 258 }, { "content": " def _getGroups(self, ids):\n \"\"\"Get a list of group with ids\"\"\"\n if type(ids) != list:\n msg = \"argument should be list of group ids\"\n self.raise_error(msg)\n\n return self._client.getGroups(ids)", "metadata": "root.LineAPI._getGroups", "header": "['class', 'LineAPI', '(', 'object', ')', ':', '___EOS___']", "index": 262 }, { "content": " def _getGroupIdsJoined(self):\n \"\"\"Get group id that you joined\"\"\"\n return self._client.getGroupIdsJoined()", "metadata": "root.LineAPI._getGroupIdsJoined", "header": "['class', 'LineAPI', '(', 'object', ')', ':', '___EOS___']", "index": 270 }, { "content": " def _getGroupIdsInvited(self):\n \"\"\"Get group id that you invited\"\"\"\n return self._client.getGroupIdsInvited()", "metadata": "root.LineAPI._getGroupIdsInvited", "header": "['class', 'LineAPI', '(', 'object', ')', ':', '___EOS___']", "index": 274 }, { "content": " def _acceptGroupInvitation(self, groupId, seq=0):\n \"\"\"Accept a group invitation\"\"\"\n return self._client.acceptGroupInvitation(seq, groupId)", "metadata": "root.LineAPI._acceptGroupInvitation", "header": "['class', 'LineAPI', '(', 'object', ')', ':', '___EOS___']", "index": 278 }, { "content": " def _kickoutFromGroup(self, groupId, contactIds=[], seq=0):\n \"\"\"Kick a group members\"\"\"\n return self._client.kickoutFromGroup(seq, groupId, contactIds)", "metadata": "root.LineAPI._kickoutFromGroup", "header": "['class', 'LineAPI', '(', 'object', ')', ':', '___EOS___']", "index": 282 }, { "content": " def _cancelGroupInvitation(self, groupId, contactIds=[], seq=0):\n \"\"\"Cancel a group invitation\"\"\"\n return self._client.cancelGroupInvitation(seq, groupId, contactIds)", "metadata": "root.LineAPI._cancelGroupInvitation", "header": "['class', 'LineAPI', '(', 'object', ')', ':', '___EOS___']", "index": 286 }, { "content": " def _inviteIntoGroup(self, groupId, contactIds=[], seq=0):\n \"\"\"Invite contacts into group\"\"\"\n return self._client.inviteIntoGroup(seq, groupId, contactIds)", "metadata": "root.LineAPI._inviteIntoGroup", "header": "['class', 'LineAPI', '(', 'object', ')', ':', '___EOS___']", "index": 290 }, { "content": " def _leaveGroup(self, id):\n \"\"\"Leave a group\"\"\"\n return self._client.leaveGroup(0, id)", "metadata": "root.LineAPI._leaveGroup", "header": "['class', 'LineAPI', '(', 'object', ')', ':', '___EOS___']", "index": 294 }, { "content": " def _getRecentMessages(self, id, count=1):\n \"\"\"Get recent messages from `id`\"\"\"\n return self._client.getRecentMessages(id, count)", "metadata": "root.LineAPI._getRecentMessages", "header": "['class', 'LineAPI', '(', 'object', ')', ':', '___EOS___']", "index": 298 }, { "content": " def _sendMessage(self, message, seq=0):\n \"\"\"Send a message to `id`. `id` could be contact id or group id\n\n :param message: `message` instance\n \"\"\"\n return self._client.sendMessage(seq, message)", "metadata": "root.LineAPI._sendMessage", "header": "['class', 'LineAPI', '(', 'object', ')', ':', '___EOS___']", "index": 302 }, { "content": " def _getLastOpRevision(self):\n return self._client.getLastOpRevision()", "metadata": "root.LineAPI._getLastOpRevision", "header": "['class', 'LineAPI', '(', 'object', ')', ':', '___EOS___']", "index": 309 }, { "content": " def _fetchOperations(self, revision, count=50):\n return self._client.fetchOperations(revision, count)", "metadata": "root.LineAPI._fetchOperations", "header": "['class', 'LineAPI', '(', 'object', ')', ':', '___EOS___']", "index": 312 }, { "content": " def _getMessageBoxCompactWrapUp(self, id):\n try:\n return self._client.getMessageBoxCompactWrapUp(id)\n except:\n return None", "metadata": "root.LineAPI._getMessageBoxCompactWrapUp", "header": "['class', 'LineAPI', '(', 'object', ')', ':', '___EOS___']", "index": 315 }, { "content": " def _getMessageBoxCompactWrapUpList(self, start=1, count=50):\n try:\n return self._client.getMessageBoxCompactWrapUpList(start, count)\n except Exception as e:\n msg = e\n self.raise_error(msg)", "metadata": "root.LineAPI._getMessageBoxCompactWrapUpList", "header": "['class', 'LineAPI', '(', 'object', ')', ':', '___EOS___']", "index": 321 }, { "content": " def raise_error(self, msg):\n \"\"\"Error format\"\"\"\n raise Exception(\"Error: %s\" % msg)", "metadata": "root.LineAPI.raise_error", "header": "['class', 'LineAPI', '(', 'object', ')', ':', '___EOS___']", "index": 328 }, { "content": " def _get_json(self, url):\n \"\"\"Get josn from given url with saved session and headers\"\"\"\n return json.loads(self._session.get(url, headers=self._headers).text)", "metadata": "root.LineAPI._get_json", "header": "['class', 'LineAPI', '(', 'object', ')', ':', '___EOS___']", "index": 332 }, { "content": " def post_content(self, url, data=None, files=None):\n return self._session.post(url, headers=self._headers, data=data, files=files)", "metadata": "root.LineAPI.post_content", "header": "['class', 'LineAPI', '(', 'object', ')', ':', '___EOS___']", "index": 336 } ]
[ { "span": "from thrift.transport import TTransport", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 39 }, { "span": "from thrift.transport import TSocket", "start_line": 18, "start_column": 0, "end_line": 18, "end_column": 36 }, { "span": "from curve.ttypes import TalkException", "start_line": 28, "start_column": 0, "end_line": 28, "end_column": 38 }, { "span": "from curve.ttypes import ToType, ContentType", "start_line": 29, "start_column": 0, "end_line": 29, "end_column": 44 } ]
[]
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", ";", " ", " ", " ", " ", "line", ".", "client", "\\", "10", ";", " ", " ", " ", " ", "~~~~~~~~~~~", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Line", "Client", " ", "for", " ", "sendin", "g", " ", "and", " ", "receiv", "ing", " ", "message", " ", "from", " ", "LINE", " ", "server", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "copyr", "ight", ":", " ", "(", "c", ")", " ", "2014", " ", "by", " ", "Ta", "eh", "oon", " ", "Ki", "m", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "license", ":", " ", "BS", "D", ",", " ", "see", " ", "LICENSE", " ", "for", " ", "more", " ", "deta", "il", "s", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "rsa", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "requests_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "simplejson_", "as_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "thrift", "_", "._", "transport_", "import_", "TT", "rans", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "thrift", "_", "._", "transport_", "import_", "TS", "ocket", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "thrift", "_", "._", "transport_", "import_", "TH", "ttp", "Client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "thrift", "_", "._", "protocol_", "import_", "TC", "omp", "act", "Protocol_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reload_", "(_", "sys_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "setdefault", "encoding_", "(_", "\"", "utf", "-", "8", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "from", " ", "curve", " ", "import", " ", "Curve", "Thri", "ft_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "curve_", "import_", "Curve", "Thri", "ft_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "curve_", "._", "ttype", "s_", "import_", "Tal", "k", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "curve_", "._", "ttype", "s_", "import_", "To", "Type_", ",_", "Conten", "t", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Line", "API_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Thi", "s", " ", "class", " ", "is", " ", "a", " ", "wrapp", "er", " ", "of", " ", "LINE", " ", "API", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LINE", "\\u", "DOMAIN_", "=_", "\"", "http", "://", "gd", "2", ".", "line", ".", "nav", "er", ".", "jp", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "LINE", "\\u", "HTTP", "\\u", "URL_", "=_", "LINE", "\\u", "DOMAIN_", "+_", "\"/", "api", "/", "v", "4", "/", "Tal", "k", "Service", ".", "do", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LINE", "\\u", "HTTP", "\\u", "IN", "\\u", "URL_", "=_", "LINE", "\\u", "DOMAIN_", "+_", "\"/", "P4", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LINE", "\\u", "CERT", "IFIC", "ATE", "\\u", "URL_", "=_", "LINE", "\\u", "DOMAIN_", "+_", "\"/", "Q", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LINE", "\\u", "SES", "SION", "\\u", "LINE", "\\u", "URL_", "=_", "LINE", "\\u", "DOMAIN_", "+_", "\"/", "auth", "ct", "/", "v1", "/", "keys", "/", "line", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LINE", "\\u", "SES", "SION", "\\u", "NAV", "ER", "\\u", "URL_", "=_", "LINE", "\\u", "DOMAIN_", "+_", "\"/", "auth", "ct", "/", "v1", "/", "keys", "/", "nav", "er", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CERT", "\\u", "FILE_", "=_", "\".", "line", ".", "crt", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ip_", "=_", "\"", "127", ".0", ".0", ".1", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "version_", "=_", "\"", "5.1", ".2", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "com", "\\u", "name_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "revision_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "certificate_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "headers_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_",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u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Line", "API_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "object_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "session_", "=_", "requests_", "._", "session_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "API_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ready_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Af", "ter", " ", "login", ",", " ", "make", " ", "`", "client", "`", " ", "and", " ", "`", "client", "\\u", "in", "`", " ", "instance", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "communi", "cate", " ", "with", " ", "LINE", " ", "server", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Exception_", "(_", "\"", "Code", " ", "is", " ", "remove", "d", " ", "bec", "aus", "e", " ", "of", " ", "the", " ", "request", " ", "of", " ", "LINE", " ", "corporat", "ion", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "API_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "Auth", "Token_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Af", "ter", " ", "login", ",", " ", "update", " ", "auth", "Token", " ", "to", " ", "avoid", " ", "expir", "ation", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "auth", "Token", ".", " ", "Thi", "s", " ", "method", " ", "skip", " ", "the", " ", "Pin", "Code", " ", "validation", " ", "step", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "certificate_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "login_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "token", "Login_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "raise", "\\u", "error_", "(_", "\"", "You", " ", "need", " ", "to", " ", "login", " ", "first", ".", " ", "There", " ", "is", " ", "no", " ", "valid", " ", "certifica", "te", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "API_", "(_", "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_", "token", "Login_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "transport_", "=_", "TH", "ttp", "Client_", "._", "TH", "ttp", "Client_", "(_", "self_", "._", "LINE", "\\u", "HTTP", "\\u", "URL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "transport_", "._", "set", "Custom", "Headers_", "(_", "self_", "._", "\\u", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "protocol_", "=_", "TC", "omp", "act", "Protocol_", "._", "TC", "omp", "act", "Protocol_", "(_", "self_", "._", "transport_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "client_", "=_", "Curve", "Thri", "ft_", "._", "Client_", "(_", "self_", "._", "protocol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "API_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "login_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Logi", "n", " ", "to", " ", "LINE", " ", "server", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "provider_", "==_", "Curve", "Thri", "ft_", "._", "Provider_", "._", "LINE_", ":_", "#", " ", "LINE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "j_", "=_", "self_", "._", "\\u", "get", "\\u", "json_", "(_", "self_", "._", "LINE", "\\u", "SES", "SION", "\\u", "LINE", "\\u", "URL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "NAV", "ER_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "j_", "=_", "self_", "._", "\\u", "get", "\\u", "json_", "(_", "self_", "._", "LINE", "\\u", "SES", "SION", "\\u", "NAV", "ER", "\\u", "URL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "session", "\\u", "key_", "=_", "j_", "[_", "'", "session", "\\u", "key", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "=_", "(_", "chr_", "(_", "len_", "(_", "session", "\\u", "key_", ")_", ")_", "+_", "session", "\\u", "key_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "chr_", "(_", "len_", "(_", "self_", "._", "id_", ")_", ")_", "+_", "self_", "._", "id_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "chr_", "(_", "len_", "(_", "self_", "._", "password_", ")_", ")_", "+_", "self_", "._", "password_", ")_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "keyname_", ",_", "n_", ",_", "e_", "=_", "j_", "[_", "'", "rsa", "\\u", "key", "'_", "]_", "._", "split_", "(_", "\",\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pub", "\\u", "key_", "=_", "rsa", "_", "._", "Public", "Key_", "(_", "int_", "(_", "n_", ",_", "16_", ")_", ",_", "int_", "(_", "e_", ",_", "16_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "crypto_", "=_", "rsa", "_", "._", "encrypt_", "(_", "message_", ",_", "pub", "\\u", "key_", ")_", "._", "encode_", "(_", "'", "hex", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "transport_", "=_", "TH", "ttp", "Client_", "._", "TH", "ttp", "Client_", "(_", "self_", "._", "LINE", "\\u", "HTTP", "\\u", "URL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "transport_", "._", "set", "Custom", "Headers_", "(_", "self_", "._", "\\u", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "protocol_", "=_", "TC", "omp", "act", "Protocol_", "._", "TC", "omp", "act", "Protocol_", "(_", "self_", "._", "transport_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "client_", "=_", "Curve", "Thri", "ft_", "._", "Client_", "(_", "self_", "._", "protocol_", ")_", "\\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 ", " _", "with_", "open_", "(_", "self_", "._", "CERT", "\\u", "FILE_", ",_", "'", "r", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "certificate_", "=_", "f_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "certificate_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg_", "=_", "self_", "._", "\\u", "client_", "._", "login", "With", "Ident", "it", "y", "Cred", "ential", "For", "Certificate_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "id_", ",_", "self_", "._", "password_", ",_", "keyname_", ",_", "crypto_", ",_", "True_", ",_", "self_", "._", "ip_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "com", "\\u", "name_", ",_", "self_", "._", "provider_", ",_", "self_", "._", "certificate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "msg_", "._", "type_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "certificate_", "=_", "msg_", "._", "certificate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "auth", "Token_", "=_", "self_", "._", "\\u", "headers_", "[_", "'", "X", "-", "Line", "-", "Access", "'_", "]_", "=_", "msg_", "._", "auth", "Token_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "msg_", "._", "type_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "\"", "require", " ", "QR", " ", "code", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "raise", "\\u", "error_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "msg_", "._", "type_", "==_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "headers_", "[_", "'", "X", "-", "Line", "-", "Access", "'_", "]_", "=_", "msg_", "._", "verifier_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "pin", "Code_", "=_", "msg_", "._", "pin", "Code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"", "Enter", " ", "Pin", "Code", " ", "'%", "s", "'", " ", "to", " ", "your", " ", "mobile", " ", "phone", " ", "in", " ", "2", " ", "minute", "s", "\"_", "%_", "self_", "._", "\\u", "pin", "Code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "j_", "=_", "self_", "._", "get", "\\u", "json_", "(_", "self_", "._", "LINE", "\\u", "CERT", "IFIC", "ATE", "\\u", "URL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "verifier_", "=_", "j_", "[_", "'", "result", "'_", "]_", "[_", "'", "verifier", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "=_", "self_", "._", "\\u", "client_", "._", "login", "With", "Verifie", "r", "For", "Certificate_", "(_", "self_", "._", "verifier_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "msg_", "._", "type_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "msg_", "._", "certificate_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "with_", "open_", "(_", "self_", "._", "CERT", "\\u", "FILE_", ",_", "'", "w", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "f_", "._", "write_", "(_", "msg_", "._", "certificate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "certificate_", "=_", "msg_", "._", "certificate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "msg_", "._", "auth", "Token_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "auth", "Token_", "=_", "self_", "._", "\\u", "headers_", "[_", "'", "X", "-", "Line", "-", "Access", "'_", "]_", "=_", "msg_", "._", "auth", "Token_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\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 ", " _", "msg_", "=_", "\"", "Requ", "ire", " ", "device", " ", "confirm", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "raise", "\\u", "error_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "raise", " ", "Except", "ion", "(\"", "Code", " ", "is", " ", "remove", "d", " ", "bec", "aus", "e", " ", "of", " ", "the", " ", "request", " ", "of", " ", "LINE", " ", "corporat", "ion", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "auth", "Token_", "=_", "self_", "._", "\\u", "headers_", "[_", "'", "X", "-", "Line", "-", "Access", "'_", "]_", "=_", "msg_", "._", "auth", "Token_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "API_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "json_", "(_", "self_", ",_", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "jos", "n", " ", "from", " ", "give", "n", " ", "url", " ", "with", " ", "saved", " ", "session", " ", "and", " ", "header", "s", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "json_", "._", "loads_", "(_", "self_", "._", "\\u", "session_", "._", "get_", "(_", "url_", ",_", "headers_", "=_", "self_", "._", "\\u", "headers_", ")_", "._", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "API_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "Profile_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "profile", " ", "informati", "on", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "Profil", "e", " ", "object", "\\", "10", ";", " ", " ", "-", " ", "pic", "ture", "Path", "\\", "10", ";", " ", " ", "-", " ", "display", "Name", "\\", "10", ";", " ", " ", "-", " ", "phone", " ", "(", "base64", " ", "encode", "d", "?)", "\\", "10", ";", " ", " ", "-", " ", "allow", "Sear", "ch", "By", "User", "id", "\\", "10", ";", " ", " ", "-", " ", "pic", "ture", "Status", "\\", "10", ";", " ", " ", "-", " ", "user", "id", "\\", "10", ";", " ", " ", "-", " ", "mid", " ", "#", " ", "used", " ", "for", " ", "unique", " ", "id", " ", "for", " ", "account", "\\", "10", ";", " ", " ", "-", " ", "phone", "tic", "Name", "\\", "10", ";", " ", " ", "-", " ", "region", "Code", "\\", "10", ";", " ", " ", "-", " ", "allow", "Sear", "ch", "By", "Ema", "il", "\\", "10", ";", " ", " ", "-", " ", "email", "\\", "10", ";", " ", " ", "-", " ", "status", "Messag", "e", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "client_", "._", "get", "Profile_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "API_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "All", "Conta", "ct", "Ids_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "all", " ", "contact", "s", " ", "of", " ", "your", " ", "LINE", " ", "account", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "client_", "._", "get", "All", "Conta", "ct", "Ids_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "API_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "Blocked", "Conta", "ct", "Ids_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "all", " ", "block", "ed", " ", "contact", "s", " ", "of", " ", "your", " ", "LINE", " ", "account", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "client_", "._", "get", "Blocked", "Conta", "ct", "Ids_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "API_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "Conta", "cts_", "(_", "self_", ",_", "ids_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "contact", " ", "informati", "on", " ", "list", " ", "from", " ", "ids", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "List", " ", "of", " ", "Conta", "ct", " ", "list", "\\", "10", ";", " ", " ", "-", " ", "status", "\\", "10", ";", " ", " ", "-", " ", "capable", "Vid", "eo", "Call", "\\", "10", ";", " ", " ", "-", " ", "disp", "aly", "Name", "\\", "10", ";", " ", " ", "-", " ", "settings", "\\", "10", ";", " ", " ", "-", " ", "pic", "ture", "Status", "\\", "10", ";", " ", " ", "-", " ", "capable", "Voic", "e", "Call", "\\", "10", ";", " ", " ", "-", " ", "capable", "Bud", "dy", "\\", "10", ";", " ", " ", "-", " ", "mid", "\\", "10", ";", " ", " ", "-", " ", "display", "Name", "Over", "rid", "den", "\\", "10", ";", " ", " ", "-", " ", "relation", "\\", "10", ";", " ", " ", "-", " ", "thumbnail", "Ur", "l", "\\", "10", ";", " ", " ", "-", " ", "created", "Time", "\\", "10", ";", " ", " ", "-", " ", "fac", "ori", "te", "Time", "\\", "10", ";", " ", " ", "-", " ", "capable", "My", "home", "\\", "10", ";", " ", " ", "-", " ", "attribute", "s", "\\", "10", ";", " ", " ", "-", " ", "type", "\\", "10", ";", " ", " ", "-", " ", "phone", "tic", "Name", "\\", "10", ";", " ", " ", "-", " ", "status", "Messag", "e", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "(_", "ids_", ")_", "!=_", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "\"", "argu", "ment", " ", "shou", "ld", " ", "be", " ", "list", " ", "of", " ", "contact", " ", "ids", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "raise", "\\u", "error_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "client_", "._", "get", "Conta", "cts_", "(_", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "API_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "find", "And", "Add", "Conta", "ct", "s", "By", "Mid", "_", "(_", "self_", ",_", "mid_", ",_", "seq_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Fin", "d", " ", "and", " ", "add", " ", "contact", "s", " ", "by", " ", "Mid", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "client_", "._", "find", "And", "Add", "Conta", "ct", "s", "By", "Mid", "_", "(_", "seq_", ",_", "mid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "API_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "find", "Conta", "ct", "By", "User", "id_", "(_", "self_", ",_", "userid_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Fin", "d", " ", "contact", "s", " ", "by", " ", "User", "id", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "client_", "._", "find", "Conta", "ct", "By", "User", "id_", "(_", "userid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "API_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "find", "And", "Add", "Conta", "ct", "s", "By", "User", "id_", "(_", "self_", ",_", "userid_", ",_", "seq_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Fin", "d", " ", "and", " ", "add", " ", "contact", "s", " ", "by", " ", "User", "id", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "client_", "._", "find", "And", "Add", "Conta", "ct", "s", "By", "User", "id_", "(_", "seq_", ",_", "userid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "API_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "find", "Conta", "ct", "s", "By", "Phone", "_", "(_", "self_", ",_", "phones_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Fin", "d", " ", "contact", "s", " ", "by", " ", "phone", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "client_", "._", "find", "Conta", "ct", "s", "By", "Phone", "_", "(_", "phones_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "API_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "find", "And", "Add", "Conta", "ct", "s", "By", "Phone", "_", "(_", "self_", ",_", "phones_", ",_", "seq_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Fin", "d", " ", "and", " ", "add", " ", "contact", "s", " ", "by", " ", "phone", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "client_", "._", "find", "And", "Add", "Conta", "ct", "s", "By", "Phone", "_", "(_", "seq_", ",_", "phones_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "API_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "find", "Conta", "ct", "s", "By", "Email_", "(_", "self_", ",_", "emails_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Fin", "d", " ", "contact", "s", " ", "by", " ", "email", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "client_", "._", "find", "Conta", "ct", "s", "By", "Email_", "(_", "emails_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "API_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "find", "And", "Add", "Conta", "ct", "s", "By", "Email_", "(_", "self_", ",_", "emails_", ",_", "seq_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Fin", "d", " ", "and", " ", "add", " ", "contact", "s", " ", "by", " ", "email", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "client_", "._", "find", "And", "Add", "Conta", "ct", "s", "By", "Email_", "(_", "seq_", ",_", "emails_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "API_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "create", "Room_", "(_", "self_", ",_", "ids_", ",_", "seq_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "e", " ", "a", " ", "chat", " ", "room", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "client_", "._", "create", "Room_", "(_", "seq_", ",_", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "API_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "Room_", "(_", "self_", ",_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "a", " ", "chat", " ", "room", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "client_", "._", "get", "Room_", "(_", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "API_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "invite", "Int", "o", "Room_", "(_", "self_", ",_", "room", "Id_", ",_", "contact", "Ids_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Invite", " ", "contact", "s", " ", "int", "o", " ", "room", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "client_", "._", "invite", "Int", "o", "Room_", "(_", "0_", ",_", "room", "Id_", ",_", "contact", "Ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "API_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "lea", "ve", "Room_", "(_", "self_", ",_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Leav", "e", " ", "a", " ", "chat", " ", "room", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "client_", "._", "lea", "ve", "Room_", "(_", "0_", ",_", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "API_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "create", "Group_", "(_", "self_", ",_", "name_", ",_", "ids_", ",_", "seq_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "e", " ", "a", " ", "group", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "client_", "._", "create", "Group_", "(_", "seq_", ",_", "name_", ",_", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "API_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "Groups_", "(_", "self_", ",_", "ids_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "a", " ", "list", " ", "of", " ", "group", " ", "with", " ", "ids", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "(_", "ids_", ")_", "!=_", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "\"", "argu", "ment", " ", "shou", "ld", " ", "be", " ", "list", " ", "of", " ", "group", " ", "ids", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "raise", "\\u", "error_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "client_", "._", "get", "Groups_", "(_", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "API_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "Group", "Id", "s", "Join", "ed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "group", " ", "id", " ", "tha", "t", " ", "you", " ", "joine", "d", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "client_", "._", "get", "Group", "Id", "s", "Join", "ed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "API_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "Group", "Id", "s", "Invite", "d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "group", " ", "id", " ", "tha", "t", " ", "you", " ", "invite", "d", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "client_", "._", "get", "Group", "Id", "s", "Invite", "d_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "API_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "accept", "Group", "Invitation", "_", "(_", "self_", ",_", "group", "Id_", ",_", "seq_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Accept", " ", "a", " ", "group", " ", "invitation", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "client_", "._", "accept", "Group", "Invitation", "_", "(_", "seq_", ",_", "group", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "API_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "kick", "out", "Fro", "m", "Group_", "(_", "self_", ",_", "group", "Id_", ",_", "contact", "Ids_", "=_", "[_", "]_", ",_", "seq_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Kick", " ", "a", " ", "group", " ", "member", "s", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "client_", "._", "kick", "out", "Fro", "m", "Group_", "(_", "seq_", ",_", "group", "Id_", ",_", "contact", "Ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "API_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "cancel", "Group", "Invitation", "_", "(_", "self_", ",_", "group", "Id_", ",_", "contact", "Ids_", "=_", "[_", "]_", ",_", "seq_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Cancel", " ", "a", " ", "group", " ", "invitation", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "client_", "._", "cancel", "Group", "Invitation", "_", "(_", "seq_", ",_", "group", "Id_", ",_", "contact", "Ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "API_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "invite", "Int", "o", "Group_", "(_", "self_", ",_", "group", "Id_", ",_", "contact", "Ids_", "=_", "[_", "]_", ",_", "seq_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Invite", " ", "contact", "s", " ", "int", "o", " ", "group", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "client_", "._", "invite", "Int", "o", "Group_", "(_", "seq_", ",_", "group", "Id_", ",_", "contact", "Ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "API_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "lea", "ve", "Group_", "(_", "self_", ",_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Leav", "e", " ", "a", " ", "group", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "client_", "._", "lea", "ve", "Group_", "(_", "0_", ",_", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "API_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "Rece", "nt", "Messages_", "(_", "self_", ",_", "id_", ",_", "count_", "=_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "recent", " ", "message", "s", " ", "from", " ", "`", "id", "`\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "client_", "._", "get", "Rece", "nt", "Messages_", "(_", "id_", ",_", "count_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "API_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "send", "Message_", "(_", "self_", ",_", "message_", ",_", "seq_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Sen", "d", " ", "a", " ", "message", " ", "to", " ", "`", "id", "`.", " ", "`", "id", "`", " ", "coul", "d", " ", "be", " ", "contact", " ", "id", " ", "or", " ", "group", " ", "id", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "message", ":", " ", "`", "message", "`", " ", "instance", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "client_", "._", "send", "Message_", "(_", "seq_", ",_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "API_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "Las", "t", "Op", "Revision_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "client_", "._", "get", "Las", "t", "Op", "Revision_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "API_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "fetch", "Operations_", "(_", "self_", ",_", "revision_", ",_", "count_", "=_", "50_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "client_", "._", "fetch", "Operations_", "(_", "revision_", ",_", "count_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "API_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "Messag", "e", "Box", "Compact", "Wra", "p", "Up_", "(_", "self_", ",_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "client_", "._", "get", "Messag", "e", "Box", "Compact", "Wra", "p", "Up_", "(_", "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 ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "API_", "(_", "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", "get", "Messag", "e", "Box", "Compact", "Wra", "p", "Up", "List_", "(_", "self_", ",_", "start_", "=_", "1_", ",_", "count_", "=_", "50_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "client_", "._", "get", "Messag", "e", "Box", "Compact", "Wra", "p", "Up", "List_", "(_", "start_", ",_", "count_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "raise", "\\u", "error_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "API_", "(_", "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_", "raise", "\\u", "error_", "(_", "self_", ",_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Error", " ", "format", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Exception_", "(_", "\"", "Error", ":", " ", "%", "s", "\"_", "%_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "API_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "json_", "(_", "self_", ",_", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "jos", "n", " ", "from", " ", "give", "n", " ", "url", " ", "with", " ", "saved", " ", "session", " ", "and", " ", "header", "s", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "json_", "._", "loads_", "(_", "self_", "._", "\\u", "session_", "._", "get_", "(_", "url_", ",_", "headers_", "=_", "self_", "._", "\\u", "headers_", ")_", "._", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "API_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "post", "\\u", "content_", "(_", "self_", ",_", "url_", ",_", "data_", "=_", "None_", ",_", "files_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "session_", "._", "post_", "(_", "url_", ",_", "headers_", "=_", "self_", "._", "\\u", "headers_", ",_", "data_", "=_", "data_", ",_", "files_", "=_", "files_", ")_" ]
[ 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 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 ]
Unused import
grafos-ml/test.fm/src/testfm/models/graphchi_models.py
[ { "content": "__author__ = 'linas'\n\nimport os\nimport logging\nimport subprocess\nimport tempfile\nimport datetime\nimport numpy as np\nfrom testfm.models.cutil.interface import IModel\nlogger = logging.getLogger(__name__)\nfrom scipy.io.mmio import mminfo, mmread, mmwrite\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class SVDpp(IModel):\n\n\n\n\n\n\n\n", "metadata": "root.SVDpp", "header": "['module', '___EOS___']", "index": 13 }, { "content": " def __init__(self, tmp_dir=\"/tmp\"):\n self.tmp_dir = tmp_dir\n params = {k: v[2] for k,v in self.param_details().items()}\n self.set_params(**params)", "metadata": "root.SVDpp.__init__", "header": "['class', 'SVDpp', '(', 'IModel', ')', ':', '___EOS___']", "index": 15 }, { "content": " def get_score(self, user, item):\n uid = self.umap[user]\n iid = self.imap[item]\n #check, I think graphchi changed the ouput?\n #u = np.add(self.U[uid, :10], self.U[uid, 10:])\n pred = self.global_mean + self.U_bias[uid] + self.V_bias[iid] + np.dot(self.U[uid], self.V[iid])\n return float(pred)", "metadata": "root.SVDpp.get_score", "header": "['class', 'SVDpp', '(', 'IModel', ')', ':', '___EOS___']", "index": 20 }, { "content": " def set_params(self, n_iterations=5, c_lambda=.05, c_gamma=.01):\n \"\"\"\n Set the parameters for the TensorCoFi\n \"\"\"\n self._n_iterations = n_iterations\n self._c_lambda = c_lambda\n self._c_gamma = c_gamma", "metadata": "root.SVDpp.set_params", "header": "['class', 'SVDpp', '(', 'IModel', ')', ':', '___EOS___']", "index": 28 }, { "content": " @classmethod\n def param_details(cls):\n \"\"\"\n Return parameter details for parameters\n \"\"\"\n return {\n #sorry but authors of svdpp do not provide a way to set dimensionality 'dim': (2, 100, 2, 5),\n 'n_iterations': (1, 20, 2, 5),\n 'c_lambda': (.1, 1., .1, .05),\n 'c_gamma': (0.001, 1.0, 0.1, 0.01)\n }", "metadata": "root.SVDpp.param_details", "header": "['class', 'SVDpp', '(', 'IModel', ')', ':', '___EOS___']", "index": 36 }, { "content": " def fit(self, training_data):\n training_filename = self.dump_data(training_data)\n logger.debug(\"Started training model {}\".format(__name__))\n cmd = \" \".join([\"svdpp\",\n \"--training={} \".format(training_filename),\n \"--biassgd_lambda={}\".format(self._c_lambda),\n \"--biassgd_gamma={}\".format(self._c_gamma),\n \"--minval=1 \",\n \"--maxval=5 \",\n \"--max_iter={}\".format(self._n_iterations),\n \"--quiet=1 \"])\n logger.debug(cmd)\n self.execute_command(cmd)\n\n self.global_mean = self.read_matrix(training_filename+\"_global_mean.mm\")\n self.U = self.read_matrix(training_filename+\"_U.mm\")\n self.V = self.read_matrix(training_filename+\"_V.mm\")\n #print training_filename\n self.U_bias = self.read_matrix(training_filename+\"_U_bias.mm\")\n self.V_bias = self.read_matrix(training_filename+\"_V_bias.mm\")", "metadata": "root.SVDpp.fit", "header": "['class', 'SVDpp', '(', 'IModel', ')', ':', '___EOS___']", "index": 48 }, { "content": " def dump_data(self, df):\n #first we need to reindex user and item and store their new ids\n _, df['u'] = np.unique(df.user, return_inverse=True)\n _, df['i'] = np.unique(df.item, return_inverse=True)\n\n self.umap = {\n key[0]: key[1] for key, _ in df.groupby(['user', 'u'])\n }\n\n self.imap = {\n key[0]: key[1] for key, _ in df.groupby(['item', 'i'])\n }\n\n filename = tempfile.mkstemp(prefix='graphchi', dir=self.tmp_dir, suffix=\".mtx\")\n f = os.fdopen(filename[0], \"w\")\n #print filename[1]\n f.write(\"%%MatrixMarket matrix coordinate real general\\n\")\n f.write(\"% Generated {}\\n\".format(datetime.datetime.now()))\n f.write(\"{} {} {}\\n\".format(len(df.user.unique()), len(df.item.unique()), len(df)))\n for idx, row in df.iterrows():\n r = int(row['rating'])\n if r == 0:\n r = 1\n f.write(\"{} {} {}\\n\".format(row['u']+1,row['i']+1,r))\n f.close()\n return filename[1]", "metadata": "root.SVDpp.dump_data", "header": "['class', 'SVDpp', '(', 'IModel', ')', ':', '___EOS___']", "index": 69 }, { "content": " def execute_command(self, cmd):\n if not os.environ['GRAPHCHI_ROOT']:\n raise EnvironmentError(\"Please set GRAPHCHI_ROOT\")\n #print cmd\n sub = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)\n out, err = sub.communicate()", "metadata": "root.SVDpp.execute_command", "header": "['class', 'SVDpp', '(', 'IModel', ')', ':', '___EOS___']", "index": 96 }, { "content": " def read_matrix(self, filename):\n \"\"\"\n reads grapchi format in the numpy array. The order is wrong in grapchi, therefore, we play tricks.\n\n About the second (order of rows vs. columns), we have a problem that in distributed graphlab we\n output the matrix by rows, since each node is a row, and nodes are on different machines.\n So to be compatible I left GraphChi code to confirm to GraphLab. In case it helps, here is a matlab mmread.m\n function which switches the order to be sorted by rows http://select.cs.cmu.edu/code/graphlab/mmread.m\n I am not sure if it is easy to fix it in python or not. [...]\n You are definitely right the the standard describes column\n order and not row order.\n \"\"\"\n\n logger.debug(\"Loading matrix market matrix \")\n f = open(filename, \"rb\")\n r = mmread(f)\n m = np.array(r.ravel())\n m = m.reshape(r.shape, order='F')\n # print \"mmread\", r.ravel(), r.shape\n # print \"trans\", m.ravel(), m.shape\n # if m.shape[0] > 1:\n # print m[1]\n f.close()\n return m", "metadata": "root.SVDpp.read_matrix", "header": "['class', 'SVDpp', '(', 'IModel', ')', ':', '___EOS___']", "index": 103 } ]
[ { "span": "from scipy.io.mmio import mminfo, mmread, mmwrite", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 49 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u", "author\\u\\u_", "=_", "'", "lin", "as", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "testf", "m_", "._", "models_", "._", "cut", "il_", "._", "interface_", "import_", "IM", "odel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "scipy_", "._", "io_", "._", "mmi", "o_", "import_", "mmi", "nfo_", ",_", "mm", "read_", ",_", "mm", "write_", "\\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_", "SV", "Dp", "p_", "(_", "IM", "odel_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "SV", "Dp", "p_", "(_", "IM", "odel_", ")_", ":_", "\\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_", ",_", "tmp", "\\u", "dir_", "=_", "\"/", "tmp", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "tmp", "\\u", "dir_", "=_", "tmp", "\\u", "dir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "{_", "k_", ":_", "v_", "[_", "2_", "]_", "for_", "k_", ",_", "v_", "in_", "self_", "._", "param", "\\u", "details_", "(_", ")_", "._", "items_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "params_", "(_", "**_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SV", "Dp", "p_", "(_", "IM", "odel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "score_", "(_", "self_", ",_", "user_", ",_", "item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "uid_", "=_", "self_", "._", "uma", "p_", "[_", "user_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "iid_", "=_", "self_", "._", "imap_", "[_", "item_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "check", ",", " ", "I", " ", "think", " ", "graph", "chi", " ", "change", "d", " ", "the", " ", "oup", "ut", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "u", " ", "=", " ", "np", ".", "add", "(", "self", ".", "U", "[", "uid", ",", " ", ":", "10", "],", " ", "self", ".", "U", "[", "uid", ",", " ", "10", ":]", ")_", "\\u\\u\\uNL\\u\\u\\u_", "pred_", "=_", "self_", "._", "global", "\\u", "mean_", "+_", "self_", "._", "U", "\\u", "bias_", "[_", "uid_", "]_", "+_", "self_", "._", "V", "\\u", "bias_", "[_", "iid_", "]_", "+_", "np_", "._", "dot_", "(_", "self_", "._", "U_", "[_", "uid_", "]_", ",_", "self_", "._", "V_", "[_", "iid_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "float_", "(_", "pred_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SV", "Dp", "p_", "(_", "IM", "odel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "params_", "(_", "self_", ",_", "n", "\\u", "iterations_", "=_", "5_", ",_", "c\\u", "lambda_", "=_", ".05_", ",_", "c\\u", "gamma_", "=_", ".01_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Set", " ", "the", " ", "parameter", "s", " ", "for", " ", "the", " ", "Tensor", "Co", "Fi", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "n", "\\u", "iterations_", "=_", "n", "\\u", "iterations_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "c\\u", "lambda_", "=_", "c\\u", "lambda_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "c\\u", "gamma_", "=_", "c\\u", "gamma_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SV", "Dp", "p_", "(_", "IM", "odel_", ")_", ":_", "\\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_", "param", "\\u", "details_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "parameter", " ", "deta", "il", "s", " ", "for", " ", "parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", "sorr", "y", " ", "but", " ", "author", "s", " ", "of", " ", "svd", "pp", " ", "do", " ", "not", " ", "provide", " ", "a", " ", "way", " ", "to", " ", "set", " ", "dimensionality", " ", "'", "dim", "':", " ", "(", "2", ",", " ", "100", ",", " ", "2", ",", " ", "5", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "'", "n", "\\u", "iterati", "ons", "'_", ":_", "(_", "1_", ",_", "20_", ",_", "2_", ",_", "5_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "c\\u", "lambda", "'_", ":_", "(_", ".1_", ",_", "1._", ",_", ".1_", ",_", ".05_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "c\\u", "gamma", "'_", ":_", "(_", "0.001_", ",_", "1.0_", ",_", "0.1_", ",_", "0.01_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SV", "Dp", "p_", "(_", "IM", "odel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "fit_", "(_", "self_", ",_", "train", "ing", "\\u", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "train", "ing", "\\u", "filename_", "=_", "self_", "._", "dump", "\\u", "data_", "(_", "train", "ing", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "\"", "Start", "ed", " ", "train", "ing", " ", "model", " ", "{}\"_", "._", "format_", "(_", "\\u\\u", "name\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "\"", " ", "\"_", "._", "join_", "(_", "[_", "\"", "svd", "pp", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"--", "train", "ing", "={}", " ", "\"_", "._", "format_", "(_", "train", "ing", "\\u", "filename_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"--", "bias", "sgd", "\\u", "lambda", "={}\"_", "._", "format_", "(_", "self_", "._", "\\u", "c\\u", "lambda_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"--", "bias", "sgd", "\\u", "gamma", "={}\"_", "._", "format_", "(_", "self_", "._", "\\u", "c\\u", "gamma_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"--", "minv", "al", "=", "1", " ", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"--", "maxva", "l", "=", "5", " ", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"--", "max", "\\u", "iter", "={}\"_", "._", "format_", "(_", "self_", "._", "\\u", "n", "\\u", "iterations_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"--", "quie", "t", "=", "1", " ", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "execute", "\\u", "command_", "(_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "global", "\\u", "mean_", "=_", "self_", "._", "read", "\\u", "matrix_", "(_", "train", "ing", "\\u", "filename_", "+_", "\"\\u", "global", "\\u", "mean", ".", "mm", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "U_", "=_", "self_", "._", "read", "\\u", "matrix_", "(_", "train", "ing", "\\u", "filename_", "+_", "\"\\u", "U", ".", "mm", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "V_", "=_", "self_", "._", "read", "\\u", "matrix_", "(_", "train", "ing", "\\u", "filename_", "+_", "\"\\u", "V", ".", "mm", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "train", "ing", "\\u", "filename_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "U", "\\u", "bias_", "=_", "self_", "._", "read", "\\u", "matrix_", "(_", "train", "ing", "\\u", "filename_", "+_", "\"\\u", "U", "\\u", "bias", ".", "mm", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "V", "\\u", "bias_", "=_", "self_", "._", "read", "\\u", "matrix_", "(_", "train", "ing", "\\u", "filename_", "+_", "\"\\u", "V", "\\u", "bias", ".", "mm", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SV", "Dp", "p_", "(_", "IM", "odel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "dump", "\\u", "data_", "(_", "self_", ",_", "df_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "first", " ", "we", " ", "need", " ", "to", " ", "reindex", " ", "user", " ", "and", " ", "item", " ", "and", " ", "store", " ", "thei", "r", " ", "new", " ", "ids_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u_", ",_", "df_", "[_", "'", "u", "'_", "]_", "=_", "np_", "._", "unique_", "(_", "df_", "._", "user_", ",_", "return", "\\u", "inverse_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u_", ",_", "df_", "[_", "'", "i", "'_", "]_", "=_", "np_", "._", "unique_", "(_", "df_", "._", "item_", ",_", "return", "\\u", "inverse_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "uma", "p_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "key_", "[_", "0_", "]_", ":_", "key_", "[_", "1_", "]_", "for_", "key_", ",_", "\\u_", "in_", "df_", "._", "groupby_", "(_", "[_", "'", "user", "'_", ",_", "'", "u", "'_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "imap_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "key_", "[_", "0_", "]_", ":_", "key_", "[_", "1_", "]_", "for_", "key_", ",_", "\\u_", "in_", "df_", "._", "groupby_", "(_", "[_", "'", "item", "'_", ",_", "'", "i", "'_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "filename_", "=_", "tempfile_", "._", "mkstemp_", "(_", "prefix_", "=_", "'", "graph", "chi", "'_", ",_", "dir_", "=_", "self_", "._", "tmp", "\\u", "dir_", ",_", "suffix_", "=_", "\".", "mtx", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "os_", "._", "fdo", "pen_", "(_", "filename_", "[_", "0_", "]_", ",_", "\"", "w", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "filename", "[", "1", "]_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "._", "write_", "(_", "\"%%", "Matrix", "Market", " ", "matrix", " ", "coordinate", " ", "real", " ", "genera", "l", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "\"%", " ", "Generate", "d", " ", "{}", "\\\\", "n", "\"_", "._", "format_", "(_", "datetime_", "._", "datetime_", "._", "now_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "\"{}", " ", "{}", " ", "{}", "\\\\", "n", "\"_", "._", "format_", "(_", "len_", "(_", "df_", "._", "user_", "._", "unique_", "(_", ")_", ")_", ",_", "len_", "(_", "df_", "._", "item_", "._", "unique_", "(_", ")_", ")_", ",_", "len_", "(_", "df_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "idx_", ",_", "row_", "in_", "df_", "._", "iterrows_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "=_", "int_", "(_", "row_", "[_", "'", "rati", "ng", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "r_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "._", "write_", "(_", "\"{}", " ", "{}", " ", "{}", "\\\\", "n", "\"_", "._", "format_", "(_", "row_", "[_", "'", "u", "'_", "]_", "+_", "1_", ",_", "row_", "[_", "'", "i", "'_", "]_", "+_", "1_", ",_", "r_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "filename_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SV", "Dp", "p_", "(_", "IM", "odel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "execute", "\\u", "command_", "(_", "self_", ",_", "cmd_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "os_", "._", "environ_", "[_", "'", "GRAPH", "CHI", "\\u", "ROO", "T", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Environ", "ment", "Error_", "(_", "\"", "Ple", "ase", " ", "set", " ", "GRAPH", "CHI", "\\u", "ROO", "T", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "cmd_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sub_", "=_", "subprocess_", "._", "Popen_", "(_", "cmd_", "._", "split_", "(_", ")_", ",_", "stdout_", "=_", "subprocess_", "._", "PIPE_", ",_", "stderr_", "=_", "subprocess_", "._", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", ",_", "err_", "=_", "sub_", "._", "communicate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SV", "Dp", "p_", "(_", "IM", "odel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read", "\\u", "matrix_", "(_", "self_", ",_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "reads", " ", "gra", "pch", "i", " ", "format", " ", "in", " ", "the", " ", "nump", "y", " ", "array", ".", " ", "The", " ", "order", " ", "is", " ", "wrong", " ", "in", " ", "gra", "pch", "i", ",", " ", "there", "fore", ",", " ", "we", " ", "play", " ", "trick", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Abo", "ut", " ", "the", " ", "second", " ", "(", "order", " ", "of", " ", "rows", " ", "vs", ".", " ", "column", "s", "),", " ", "we", " ", "have", " ", "a", " ", "problem", " ", "tha", "t", " ", "in", " ", "distributed", " ", "graph", "lab", " ", "we", "\\", "10", ";", " ", " ", " ", " ", "output", " ", "the", " ", "matrix", " ", "by", " ", "rows", ",", " ", "sinc", "e", " ", "each", " ", "node", " ", "is", " ", "a", " ", "row", ",", " ", "and", " ", "nodes", " ", "are", " ", "on", " ", "different", " ", "machine", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "So", " ", "to", " ", "be", " ", "compatible", " ", "I", " ", "left", " ", "Graph", "Chi", " ", "code", " ", "to", " ", "confirm", " ", "to", " ", "Graph", "Lab", ".", " ", "In", " ", "case", " ", "it", " ", "helps", ",", " ", "here", " ", "is", " ", "a", " ", "matlab", " ", "mm", "read", ".", "m", "\\", "10", ";", " ", " ", " ", " ", "function", " ", "whi", "ch", " ", "switche", "s", " ", "the", " ", "order", " ", "to", " ", "be", " ", "sorte", "d", " ", "by", " ", "rows", " ", "http", "://", "select", ".", "cs", ".", "cm", "u", ".", "edu", "/", "code", "/", "graph", "lab", "/", "mm", "read", ".", "m", "\\", "10", ";", " ", " ", " ", " ", "I", " ", "am", " ", "not", " ", "sure", " ", "if", " ", "it", " ", "is", " ", "easy", " ", "to", " ", "fix", " ", "it", " ", "in", " ", "python", " ", "or", " ", "not", ".", " ", "[...", "]", "\\", "10", ";", " ", " ", " ", " ", "You", " ", "are", " ", "definit", "el", "y", " ", "right", " ", "the", " ", "the", " ", "standard", " ", "descri", "bes", " ", "column", "\\", "10", ";", " ", " ", " ", " ", "order", " ", "and", " ", "not", " ", "row", " ", "order", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "._", "debug_", "(_", "\"", "Load", "ing", " ", "matrix", " ", "market", " ", "matrix", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "open_", "(_", "filename_", ",_", "\"", "rb", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "=_", "mm", "read_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "=_", "np_", "._", "array_", "(_", "r_", "._", "ravel_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "=_", "m_", "._", "reshape_", "(_", "r_", "._", "shape_", ",_", "order_", "=_", "'", "F", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", " ", "\"", "mm", "read", "\",", " ", "r", ".", "rave", "l", "()", ",", " ", "r", ".", "shape_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "\"", "trans", "\",", " ", "m", ".", "rave", "l", "()", ",", " ", "m", ".", "shape_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "m", ".", "shape", "[", "0", "]", " ", ">", " ", "1", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "m", "[", "1", "]_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "m_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 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 ]
Variable defined multiple times
ardekantur/pyglet/tests/resource/RES_LOAD.py
[ { "content": " def test16a(self):\n self.check_file(['dir1/res.zip/'], 'dir1/file.txt', 'F8')", "metadata": "root.TestCase.test16a", "header": "['class', 'TestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 146 }, { "content": " def test16a(self):\n self.check_file(['dir1/res.zip/'], 'dir1/dir1/file.txt', 'F9')", "metadata": "root.TestCase.test16a", "header": "['class', 'TestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 149 } ]
[ { "span": "test16a(", "start_line": 146, "start_column": 8, "end_line": 146, "end_column": 15 } ]
[ { "span": "test16a(", "start_line": 149, "start_column": 8, "end_line": 149, "end_column": 15 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "16", "a_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "check", "\\u", "file_", "(_", "[_", "'", "dir", "1", "/", "res", ".", "zip", "/'_", "]_", ",_", "'", "dir", "1", "/", "file", ".", "txt", "'_", ",_", "'", "F8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "16", "a_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "check", "\\u", "file_", "(_", "[_", "'", "dir", "1", "/", "res", ".", "zip", "/'_", "]_", ",_", "'", "dir", "1", "/", "dir", "1", "/", "file", ".", "txt", "'_", ",_", "'", "F", "9", "'_", ")_", "\\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, 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, 3, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
ProgVal/Limnoria/plugins/Ctcp/plugin.py
[ { "content": "###\n# Copyright (c) 2002-2004, Jeremiah Fincher\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are met:\n#\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 notice,\n# 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 author of this software nor the name of\n# contributors to this software may be used to endorse or promote products\n# derived from this software without specific prior written consent.\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, THE\n# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n# POSSIBILITY OF SUCH DAMAGE.\n###\n\nimport time\n\nimport supybot.conf as conf\nimport supybot.utils as utils\nfrom supybot.commands import *\nimport supybot.ircmsgs as ircmsgs\nimport supybot.ircutils as ircutils\nimport supybot.schedule as schedule\nimport supybot.callbacks as callbacks\nfrom supybot.i18n import PluginInternationalization, internationalizeDocstring\n_ = PluginInternationalization('Ctcp')\n\n\nClass = Ctcp\n# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Ctcp(callbacks.PluginRegexp):\n \"\"\"Provides replies to common CTCPs (version, time, etc.), and a command\n to fetch version responses from channels.\"\"\"\n public = False\n regexps = ('ctcpPing', 'ctcpVersion', 'ctcpUserinfo',\n 'ctcpTime', 'ctcpFinger', 'ctcpSource')\n\n\n\n\n\n\n\n\n\n\n\n version = wrap(version, ['channel', getopts({'nicks':''})])", "metadata": "root.Ctcp", "header": "['module', '___EOS___']", "index": 41 }, { "content": " def __init__(self, irc):\n self.__parent = super(Ctcp, self)\n self.__parent.__init__(irc)\n self.ignores = ircutils.IrcDict()\n self.floods = ircutils.FloodQueue(conf.supybot.abuse.flood.interval())\n conf.supybot.abuse.flood.interval.addCallback(self.setFloodQueueTimeout)", "metadata": "root.Ctcp.__init__", "header": "['class', 'Ctcp', '(', 'callbacks', '.', 'PluginRegexp', ')', ':', '___EOS___']", "index": 47 }, { "content": " def setFloodQueueTimeout(self, *args, **kwargs):\n self.floods.timeout = conf.supybot.abuse.flood.interval()", "metadata": "root.Ctcp.setFloodQueueTimeout", "header": "['class', 'Ctcp', '(', 'callbacks', '.', 'PluginRegexp', ')', ':', '___EOS___']", "index": 54 }, { "content": " def callCommand(self, command, irc, msg, *args, **kwargs):\n if conf.supybot.abuse.flood.ctcp():\n now = time.time()\n for (ignore, expiration) in self.ignores.items():\n if expiration < now:\n del self.ignores[ignore]\n elif ircutils.hostmaskPatternEqual(ignore, msg.prefix):\n return\n self.floods.enqueue(msg)\n max = conf.supybot.abuse.flood.ctcp.maximum()\n if self.floods.len(msg) > max:\n expires = conf.supybot.abuse.flood.ctcp.punishment()\n self.log.warning('Apparent CTCP flood from %s, '\n 'ignoring CTCP messages for %s seconds.',\n msg.prefix, expires)\n ignoreMask = '*!%s@%s' % (msg.user, msg.host)\n self.ignores[ignoreMask] = now + expires\n return\n self.__parent.callCommand(command, irc, msg, *args, **kwargs)", "metadata": "root.Ctcp.callCommand", "header": "['class', 'Ctcp', '(', 'callbacks', '.', 'PluginRegexp', ')', ':', '___EOS___']", "index": 57 }, { "content": " def _reply(self, irc, msg, s):\n s = '\\x01%s\\x01' % s\n irc.reply(s, notice=True, private=True, to=msg.nick)", "metadata": "root.Ctcp._reply", "header": "['class', 'Ctcp', '(', 'callbacks', '.', 'PluginRegexp', ')', ':', '___EOS___']", "index": 77 }, { "content": " def ctcpPing(self, irc, msg, match):\n \"^\\x01PING(?: (.+))?\\x01$\"\n self.log.info('Received CTCP PING from %s', msg.prefix)\n payload = match.group(1)\n if payload:\n self._reply(irc, msg, 'PING %s' % match.group(1))\n else:\n self._reply(irc, msg, 'PING')", "metadata": "root.Ctcp.ctcpPing", "header": "['class', 'Ctcp', '(', 'callbacks', '.', 'PluginRegexp', ')', ':', '___EOS___']", "index": 81 }, { "content": " def ctcpVersion(self, irc, msg, match):\n \"^\\x01VERSION\\x01$\"\n self.log.info('Received CTCP VERSION from %s', msg.prefix)\n self._reply(irc, msg, 'VERSION Supybot %s' % conf.version)", "metadata": "root.Ctcp.ctcpVersion", "header": "['class', 'Ctcp', '(', 'callbacks', '.', 'PluginRegexp', ')', ':', '___EOS___']", "index": 90 }, { "content": " def ctcpUserinfo(self, irc, msg, match):\n \"^\\x01USERINFO\\x01$\"\n self.log.info('Received CTCP USERINFO from %s', msg.prefix)\n self._reply(irc, msg, 'USERINFO %s' % self.registryValue('userinfo'))", "metadata": "root.Ctcp.ctcpUserinfo", "header": "['class', 'Ctcp', '(', 'callbacks', '.', 'PluginRegexp', ')', ':', '___EOS___']", "index": 95 }, { "content": " def ctcpTime(self, irc, msg, match):\n \"^\\x01TIME\\x01$\"\n self.log.info('Received CTCP TIME from %s', msg.prefix)\n self._reply(irc, msg, 'TIME %s' % time.ctime())", "metadata": "root.Ctcp.ctcpTime", "header": "['class', 'Ctcp', '(', 'callbacks', '.', 'PluginRegexp', ')', ':', '___EOS___']", "index": 100 }, { "content": " def ctcpFinger(self, irc, msg, match):\n \"^\\x01FINGER\\x01$\"\n self.log.info('Received CTCP FINGER from %s', msg.prefix)\n self._reply(irc, msg, 'FINGER ' + \n _('Supybot, the best Python IRC bot in existence!'))", "metadata": "root.Ctcp.ctcpFinger", "header": "['class', 'Ctcp', '(', 'callbacks', '.', 'PluginRegexp', ')', ':', '___EOS___']", "index": 105 }, { "content": " def ctcpSource(self, irc, msg, match):\n \"^\\x01SOURCE\\x01$\"\n self.log.info('Received CTCP SOURCE from %s', msg.prefix)\n self._reply(irc, msg,\n 'SOURCE https://github.com/ProgVal/Limnoria')", "metadata": "root.Ctcp.ctcpSource", "header": "['class', 'Ctcp', '(', 'callbacks', '.', 'PluginRegexp', ')', ':', '___EOS___']", "index": 111 }, { "content": " def doNotice(self, irc, msg):\n if ircmsgs.isCtcp(msg):\n try:\n (version, payload) = msg.args[1][1:-1].split(None, 1)\n except ValueError:\n return\n if version == 'VERSION':\n self.versions.setdefault(payload, []).append(msg.nick)", "metadata": "root.Ctcp.doNotice", "header": "['class', 'Ctcp', '(', 'callbacks', '.', 'PluginRegexp', ')', ':', '___EOS___']", "index": 117 }, { "content": " @internationalizeDocstring\n def version(self, irc, msg, args, channel, optlist):\n \"\"\"[<channel>] [--nicks]\n\n Sends a CTCP VERSION to <channel>, returning the various\n version strings returned. It waits for 10 seconds before returning\n the versions received at that point. If --nicks is given, nicks are\n associated with the version strings; otherwise, only the version\n strings are given.\n \"\"\"\n self.versions = ircutils.IrcDict()\n nicks = False\n for (option, arg) in optlist:\n if option == 'nicks':\n nicks = True\n irc.queueMsg(ircmsgs.privmsg(channel, '\\x01VERSION\\x01'))\n def doReply():\n if self.versions:\n L = []\n for (reply, nickslist) in self.versions.items():\n if nicks:\n L.append(format('%L responded with %q', nickslist, reply))\n else:\n L.append(reply)\n irc.reply(format('%L', L))\n else:\n irc.reply('I received no version responses.')\n wait = self.registryValue('versionWait')\n schedule.addEvent(doReply, time.time()+wait)", "metadata": "root.Ctcp.version", "header": "['class', 'Ctcp', '(', 'callbacks', '.', 'PluginRegexp', ')', ':', '___EOS___']", "index": 126 } ]
[ { "span": "import supybot.utils as utils", "start_line": 32, "start_column": 0, "end_line": 32, "end_column": 29 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2002", "-", "2004", ",", " ", "Jer", "emi", "ah", " ", "Fin", "cher", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Redistributi", "on", " ", "and", " ", "use", " ", "in", " ", "source", " ", "and", " ", "binar", "y", " ", "forms", ",", " ", "with", " ", "or", " ", "with", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "modification", ",", " ", "are", " ", "permit", "ted", " ", "provided", " ", "tha", "t", " ", "the", " ", "follow", "ing", " ", "condition", "s", " ", "are", " ", "met", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\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", " ", "copyr", "ight", " ", "notice", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "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", " ", "author", " ", "of", " ", "this", " ", "software", " ", "nor", " ", "the", " ", "name", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "contributor", "s", " ", "to", " ", "this", " ", "software", " ", "may", " ", "be", " ", "used", " ", "to", " ", "endo", "rse", " ", "or", " ", "promote", " ", "products_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "derive", "d", " ", "from", " ", "this", " ", "software", " ", "with", "out", " ", "specific", " ", "prior", " ", "writt", "en", " ", "consent", "._", "\\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", ",", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "AND", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ARE", " ", "DISC", "LAI", "MED", ".", " ", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", " ", "COPY", "RIG", "HT", " ", "OWNER", " ", "OR", " ", "CONTRIB", "UTO", "RS", " ", "BE_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "DIRECT", ",", " ", "INDI", "RECT", ",", " ", "INC", "IDENT", "AL", ",", " ", "SPECIAL", ",", " ", "EXE", "MPL", "ARY", ",", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "CONS", "EQU", "ENTI", "AL", " ", "DA", "MAGE", "S", " ", "(", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",", " ", "PROC", "URE", "MENT", " ", "OF_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "SUBST", "ITU", "TE", " ", "GOOD", "S", " ", "OR", " ", "SERVICES", ";", " ", "LOSS", " ", "OF", " ", "USE", ",", " ", "DATA", ",", " ", "OR", " ", "PROF", "IT", "S", ";", " ", "OR", " ", "BUS", "INE", "SS_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "INTER", "RU", "PTION", ")", " ", "HO", "WE", "VER", " ", "CAU", "SED", " ", "AND", " ", "ON", " ", "ANY", " ", "THE", "ORY", " ", "OF", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "CONTR", "ACT", ",", " ", "STRI", "CT", " ", "LI", "ABI", "LIT", "Y", ",", " ", "OR", " ", "TOR", "T", " ", "(", "INC", "LU", "DING", " ", "NEG", "LIG", "ENCE", " ", "OR", " ", "OTHER", "WI", "SE", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ARI", "SIN", "G", " ", "IN", " ", "ANY", " ", "WAY", " ", "OUT", " ", "OF", " ", "THE", " ", "USE", " ", "OF", " ", "THIS", " ", "SOFT", "WARE", ",", " ", "EVE", "N", " ", "IF", " ", "ADV", "ISE", "D", " ", "OF", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "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_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sup", "ybo", "t_", "._", "conf_", "as_", "conf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sup", "ybo", "t_", "._", "utils_", "as_", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sup", "ybo", "t_", "._", "commands_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sup", "ybo", "t_", "._", "irc", "msgs_", "as_", "irc", "msgs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sup", "ybo", "t_", "._", "irc", "utils_", "as_", "irc", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sup", "ybo", "t_", "._", "schedule_", "as_", "schedule_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sup", "ybo", "t_", "._", "callbacks_", "as_", "callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sup", "ybo", "t_", "._", "i18n_", "import_", "Plug", "in", "Intern", "ation", "ali", "zation_", ",_", "international", "ize", "Docs", "tring_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u_", "=_", "Plug", "in", "Intern", "ation", "ali", "zation_", "(_", "'", "Ct", "cp", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Class_", "=_", "Ct", "cp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "vim", ":", "set", " ", "shift", "widt", "h", "=", "4", " ", "soft", "tabs", "top", "=", "4", " ", "expand", "tab", " ", "text", "widt", "h", "=", "7", "9", ":_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Ct", "cp_", "(_", "callbacks_", "._", "Plug", "in", "Regexp_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Prov", "ides", " ", "replies", " ", "to", " ", "common", " ", "CTC", "Ps", " ", "(", "version", ",", " ", "time", ",", " ", "etc", ".)", ",", " ", "and", " ", "a", " ", "command", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "fetch", " ", "version", " ", "response", "s", " ", "from", " ", "channel", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "public_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "regexp", "s_", "=_", "(_", "'", "ctc", "p", "Ping", "'_", ",_", "'", "ctc", "p", "Version", "'_", ",_", "'", "ctc", "p", "User", "info", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ctc", "p", "Time", "'_", ",_", "'", "ctc", "p", "Fin", "ger", "'_", ",_", "'", "ctc", "p", "Sou", "rce", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "version_", "=_", "wrap_", "(_", "version_", ",_", "[_", "'", "channel", "'_", ",_", "getop", "ts_", "(_", "{_", "'", "nicks", "'_", ":_", "''_", "}_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ct", "cp_", "(_", "callbacks_", "._", "Plug", "in", "Regexp_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "irc_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "parent_", "=_", "super_", "(_", "Ct", "cp_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "parent_", "._", "\\u\\u", "init\\u\\u_", "(_", "irc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ignores", "_", "=_", "irc", "utils_", "._", "Ir", "c", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "flood", "s_", "=_", "irc", "utils_", "._", "Flood", "Queue_", "(_", "conf_", "._", "sup", "ybo", "t_", "._", "abu", "se_", "._", "flood", "_", "._", "interval_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conf_", "._", "sup", "ybo", "t_", "._", "abu", "se_", "._", "flood", "_", "._", "interval_", "._", "add", "Callback_", "(_", "self_", "._", "set", "Flood", "Queue", "Timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ct", "cp_", "(_", "callbacks_", "._", "Plug", "in", "Regexp_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Flood", "Queue", "Timeout_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "flood", "s_", "._", "timeout_", "=_", "conf_", "._", "sup", "ybo", "t_", "._", "abu", "se_", "._", "flood", "_", "._", "interval_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ct", "cp_", "(_", "callbacks_", "._", "Plug", "in", "Regexp_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "call", "Command_", "(_", "self_", ",_", "command_", ",_", "irc_", ",_", "msg_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "conf_", "._", "sup", "ybo", "t_", "._", "abu", "se_", "._", "flood", "_", "._", "ctc", "p_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "now_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "ignore_", ",_", "expiration_", ")_", "in_", "self_", "._", "ignores", "_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "expiration_", "<_", "now_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "del_", "self_", "._", "ignores", "_", "[_", "ignore_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "irc", "utils_", "._", "host", "mask", "Pat", "tern", "Equal_", "(_", "ignore_", ",_", "msg_", "._", "prefix_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "flood", "s_", "._", "enqueue_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max_", "=_", "conf_", "._", "sup", "ybo", "t_", "._", "abu", "se_", "._", "flood", "_", "._", "ctc", "p_", "._", "maximum_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "flood", "s_", "._", "len_", "(_", "msg_", ")_", ">_", "max_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "expires_", "=_", "conf_", "._", "sup", "ybo", "t_", "._", "abu", "se_", "._", "flood", "_", "._", "ctc", "p_", "._", "pun", "ish", "ment_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "._", "warning_", "(_", "'", "App", "arent", " ", "CTC", "P", " ", "flood", " ", "from", " ", "%", "s", ",", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ign", "orin", "g", " ", "CTC", "P", " ", "message", "s", " ", "for", " ", "%", "s", " ", "second", "s", ".'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "._", "prefix_", ",_", "expires_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ignore", "Mask_", "=_", "'*", "!%", "s", "@", "%", "s", "'_", "%_", "(_", "msg_", "._", "user_", ",_", "msg_", "._", "host_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ignores", "_", "[_", "ignore", "Mask_", "]_", "=_", "now_", "+_", "expires_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u\\u", "parent_", "._", "call", "Command_", "(_", "command_", ",_", "irc_", ",_", "msg_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ct", "cp_", "(_", "callbacks_", "._", "Plug", "in", "Regexp_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "reply_", "(_", "self_", ",_", "irc_", ",_", "msg_", ",_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "'\\\\", "x0", "1", "%", "s", "\\\\", "x0", "1", "'_", "%_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "irc_", "._", "reply_", "(_", "s_", ",_", "notice_", "=_", "True_", ",_", "private_", "=_", "True_", ",_", "to_", "=_", "msg_", "._", "nick_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ct", "cp_", "(_", "callbacks_", "._", "Plug", "in", "Regexp_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ctc", "p", "Ping", "_", "(_", "self_", ",_", "irc_", ",_", "msg_", ",_", "match_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "^", "\\\\", "x0", "1", "PING", "(?:", " ", "(.+", "))", "?\\\\", "x0", "1", "$\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "._", "info_", "(_", "'", "Receive", "d", " ", "CTC", "P", " ", "PING", " ", "from", " ", "%", "s", "'_", ",_", "msg_", "._", "prefix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "payload_", "=_", "match_", "._", "group_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "payload_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "reply_", "(_", "irc_", ",_", "msg_", ",_", "'", "PING", " ", "%", "s", "'_", "%_", "match_", "._", "group_", "(_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "reply_", "(_", "irc_", ",_", "msg_", ",_", "'", "PING", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ct", "cp_", "(_", "callbacks_", "._", "Plug", "in", "Regexp_", ")_", ":_", "\\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_", "ctc", "p", "Version_", "(_", "self_", ",_", "irc_", ",_", "msg_", ",_", "match_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "^", "\\\\", "x0", "1", "VERSI", "ON", "\\\\", "x0", "1", "$\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "._", "info_", "(_", "'", "Receive", "d", " ", "CTC", "P", " ", "VERSI", "ON", " ", "from", " ", "%", "s", "'_", ",_", "msg_", "._", "prefix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "reply_", "(_", "irc_", ",_", "msg_", ",_", "'", "VERSI", "ON", " ", "Sup", "ybo", "t", " ", "%", "s", "'_", "%_", "conf_", "._", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ct", "cp_", "(_", "callbacks_", "._", "Plug", "in", "Regexp_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ctc", "p", "User", "info_", "(_", "self_", ",_", "irc_", ",_", "msg_", ",_", "match_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "^", "\\\\", "x0", "1", "USER", "INFO", "\\\\", "x0", "1", "$\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "._", "info_", "(_", "'", "Receive", "d", " ", "CTC", "P", " ", "USER", "INFO", " ", "from", " ", "%", "s", "'_", ",_", "msg_", "._", "prefix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "reply_", "(_", "irc_", ",_", "msg_", ",_", "'", "USER", "INFO", " ", "%", "s", "'_", "%_", "self_", "._", "registr", "y", "Value_", "(_", "'", "userin", "fo", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ct", "cp_", "(_", "callbacks_", "._", "Plug", "in", "Regexp_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ctc", "p", "Time_", "(_", "self_", ",_", "irc_", ",_", "msg_", ",_", "match_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "^", "\\\\", "x0", "1", "TIME", "\\\\", "x0", "1", "$\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "._", "info_", "(_", "'", "Receive", "d", " ", "CTC", "P", " ", "TIME", " ", "from", " ", "%", "s", "'_", ",_", "msg_", "._", "prefix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "reply_", "(_", "irc_", ",_", "msg_", ",_", "'", "TIME", " ", "%", "s", "'_", "%_", "time_", "._", "ctime_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ct", "cp_", "(_", "callbacks_", "._", "Plug", "in", "Regexp_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ctc", "p", "Fin", "ger_", "(_", "self_", ",_", "irc_", ",_", "msg_", ",_", "match_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "^", "\\\\", "x0", "1", "FIN", "GER", "\\\\", "x0", "1", "$\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "._", "info_", "(_", "'", "Receive", "d", " ", "CTC", "P", " ", "FIN", "GER", " ", "from", " ", "%", "s", "'_", ",_", "msg_", "._", "prefix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "reply_", "(_", "irc_", ",_", "msg_", ",_", "'", "FIN", "GER", " ", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "'", "Sup", "ybo", "t", ",", " ", "the", " ", "best", " ", "Pyth", "on", " ", "IR", "C", " ", "bot", " ", "in", " ", "existence", "!'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ct", "cp_", "(_", "callbacks_", "._", "Plug", "in", "Regexp_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ctc", "p", "Source_", "(_", "self_", ",_", "irc_", ",_", "msg_", ",_", "match_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "^", "\\\\", "x0", "1", "SOU", "RC", "E", "\\\\", "x0", "1", "$\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "._", "info_", "(_", "'", "Receive", "d", " ", "CTC", "P", " ", "SOU", "RC", "E", " ", "from", " ", "%", "s", "'_", ",_", "msg_", "._", "prefix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "reply_", "(_", "irc_", ",_", "msg_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "SOU", "RC", "E", " ", "https", "://", "git", "hub", ".", "com", "/", "Prog", "Val", "/", "Lim", "nor", "ia", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ct", "cp_", "(_", "callbacks_", "._", "Plug", "in", "Regexp_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "Noti", "ce_", "(_", "self_", ",_", "irc_", ",_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "irc", "msgs_", "._", "is", "Ct", "cp_", "(_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "version_", ",_", "payload_", ")_", "=_", "msg_", "._", "args_", "[_", "1_", "]_", "[_", "1_", ":_", "-_", "1_", "]_", "._", "split_", "(_", "None_", ",_", "1_", ")_", "\\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 ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "version_", "==_", "'", "VERSI", "ON", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "versions_", "._", "setdefault_", "(_", "payload_", ",_", "[_", "]_", ")_", "._", "append_", "(_", "msg_", "._", "nick_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ct", "cp_", "(_", "callbacks_", "._", "Plug", "in", "Regexp_", ")_", ":_", "\\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_", "@_", "international", "ize", "Docs", "tring_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "version_", "(_", "self_", ",_", "irc_", ",_", "msg_", ",_", "args_", ",_", "channel_", ",_", "opt", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"[", "<", "channel", ">]", " ", "[-", "-", "nicks", "]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Sen", "ds", " ", "a", " ", "CTC", "P", " ", "VERSI", "ON", " ", "to", " ", "<", "channel", ">", ",", " ", "return", "ing", " ", "the", " ", "vari", "ous", "\\", "10", ";", " ", " ", " ", " ", "version", " ", "string", "s", " ", "return", "ed", ".", " ", " ", "It", " ", "waits", " ", "for", " ", "10", " ", "second", "s", " ", "bef", "ore", " ", "return", "ing", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "version", "s", " ", "receive", "d", " ", "at", " ", "tha", "t", " ", "point", ".", " ", " ", "If", " ", "--", "nicks", " ", "is", " ", "give", "n", ",", " ", "nicks", " ", "are", "\\", "10", ";", " ", " ", " ", " ", "associate", "d", " ", "with", " ", "the", " ", "version", " ", "string", "s", ";", " ", "other", "wis", "e", ",", " ", "only", " ", "the", " ", "version", "\\", "10", ";", " ", " ", " ", " ", "string", "s", " ", "are", " ", "give", "n", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "versions_", "=_", "irc", "utils_", "._", "Ir", "c", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nicks", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "option_", ",_", "arg_", ")_", "in_", "opt", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "option_", "==_", "'", "nicks", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nicks", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "irc_", "._", "queue", "Msg_", "(_", "irc", "msgs_", "._", "privmsg", "_", "(_", "channel_", ",_", "'\\\\", "x0", "1", "VERSI", "ON", "\\\\", "x0", "1", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "do", "Reply_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "versions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "L_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "reply_", ",_", "nicks", "list_", ")_", "in_", "self_", "._", "versions_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "nicks", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "L_", "._", "append_", "(_", "format_", "(_", "'%", "L", " ", "respond", "ed", " ", "with", " ", "%", "q", "'_", ",_", "nicks", "list_", ",_", "reply_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "L_", "._", "append_", "(_", "reply_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "irc_", "._", "reply_", "(_", "format_", "(_", "'%", "L", "'_", ",_", "L_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "irc_", "._", "reply_", "(_", "'", "I", " ", "receive", "d", " ", "no", " ", "version", " ", "response", "s", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "wait_", "=_", "self_", "._", "registr", "y", "Value_", "(_", "'", "version", "Wait", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schedule_", "._", "add", "Event_", "(_", "do", "Reply_", ",_", "time_", "._", "time_", "(_", ")_", "+_", "wait_", ")_", "\\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,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Imprecise assert
Matt-Deacalion/Pomodoro-Calculator/pomodoro_calculator/test/test_main.py
[ { "content": " def test_retriever_class_exists(self):\n \"\"\"\n Does the `PomodoroCalculator` class exist?\n \"\"\"\n self.assertTrue('PomodoroCalculator' in globals())", "metadata": "root.PomodoroTest.test_retriever_class_exists", "header": "['class', 'PomodoroTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 13 } ]
[ { "span": "self.assertTrue('PomodoroCalculator' in globals())", "start_line": 17, "start_column": 8, "end_line": 17, "end_column": 58 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Po", "modo", "ro", "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", "retrieve", "r", "\\u", "class", "\\u", "exists_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Do", "es", " ", "the", " ", "`", "Po", "modo", "ro", "Calculat", "or", "`", " ", "class", " ", "exist", "?", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "Po", "modo", "ro", "Calculat", "or", "'_", "in_", "globals_", "(_", ")_", ")_", "\\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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Unused import
bitxbay/BitXBay/electru/build/lib/electrum_plugins/pointofsale.py
[ { "content": "import re\nimport platform\nfrom decimal import Decimal\nfrom urllib import quote\n\nfrom PyQt4.QtGui import *\nfrom PyQt4.QtCore import *\nimport PyQt4.QtCore as QtCore\nimport PyQt4.QtGui as QtGui\n\nfrom electrum_gui.qt.qrcodewidget import QRCodeWidget\n\nfrom electrum import bmp, pyqrnative, BasePlugin\nfrom electrum.i18n import _\n\n\nif platform.system() == 'Windows':\n MONOSPACE_FONT = 'Lucida Console'\nelif platform.system() == 'Darwin':\n MONOSPACE_FONT = 'Monaco'\nelse:\n MONOSPACE_FONT = 'monospace'\n\ncolumn_index = 4\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class QR_Window(QWidget):\n\n\n", "metadata": "root.QR_Window", "header": "['module', '___EOS___']", "index": 25 }, { "content": " def __init__(self, exchanger):\n QWidget.__init__(self)\n self.exchanger = exchanger\n self.setWindowTitle('Electrum - '+_('Invoice'))\n self.setMinimumSize(800, 250)\n self.address = ''\n self.label = ''\n self.amount = 0\n self.setFocusPolicy(QtCore.Qt.NoFocus)\n\n main_box = QHBoxLayout()\n \n self.qrw = QRCodeWidget()\n main_box.addWidget(self.qrw, 1)\n\n vbox = QVBoxLayout()\n main_box.addLayout(vbox)\n\n self.address_label = QLabel(\"\")\n #self.address_label.setFont(QFont(MONOSPACE_FONT))\n vbox.addWidget(self.address_label)\n\n self.label_label = QLabel(\"\")\n vbox.addWidget(self.label_label)\n\n self.amount_label = QLabel(\"\")\n vbox.addWidget(self.amount_label)\n\n vbox.addStretch(1)\n self.setLayout(main_box)", "metadata": "root.QR_Window.__init__", "header": "['class', 'QR_Window', '(', 'QWidget', ')', ':', '___EOS___']", "index": 27 }, { "content": " def set_content(self, addr, label, amount, currency):\n self.address = addr\n address_text = \"<span style='font-size: 18pt'>%s</span>\" % addr if addr else \"\"\n self.address_label.setText(address_text)\n\n if currency == 'BTC': currency = None\n amount_text = ''\n if amount:\n if currency:\n try:\n self.amount = Decimal(amount) / self.exchanger.exchange(1, currency) if currency else amount\n except Exception:\n self.amount = None\n else:\n self.amount = Decimal(amount)\n self.amount = self.amount.quantize(Decimal('1.0000'))\n\n if currency:\n amount_text += \"<span style='font-size: 18pt'>%s %s</span><br/>\" % (amount, currency)\n amount_text += \"<span style='font-size: 21pt'>%s</span> <span style='font-size: 16pt'>BTC</span> \" % str(self.amount) \n else:\n self.amount = None\n \n self.amount_label.setText(amount_text)\n\n self.label = label\n label_text = \"<span style='font-size: 21pt'>%s</span>\" % label if label else \"\"\n self.label_label.setText(label_text)\n\n msg = 'bitcoin:'+self.address\n if self.amount is not None:\n msg += '?amount=%s'%(str( self.amount))\n if self.label is not None:\n encoded_label = quote(self.label)\n msg += '&label=%s'%(encoded_label)\n elif self.label is not None:\n encoded_label = quote(self.label)\n msg += '?label=%s'%(encoded_label)\n \n self.qrw.set_addr( msg )", "metadata": "root.QR_Window.set_content", "header": "['class', 'QR_Window', '(', 'QWidget', ')', ':', '___EOS___']", "index": 59 }, { "content": "class Plugin(BasePlugin):\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.Plugin", "header": "['module', '___EOS___']", "index": 103 }, { "content": " def fullname(self):\n return 'Point of Sale'", "metadata": "root.Plugin.fullname", "header": "['class', 'Plugin', '(', 'BasePlugin', ')', ':', '___EOS___']", "index": 105 }, { "content": " def description(self):\n return _('Show QR code window and amounts requested for each address. Add menu item to request amount.')+_(' Note: This requires the exchange rate plugin to be installed.')", "metadata": "root.Plugin.description", "header": "['class', 'Plugin', '(', 'BasePlugin', ')', ':', '___EOS___']", "index": 108 }, { "content": " def init(self):\n self.window = self.gui.main_window\n self.wallet = self.window.wallet\n\n self.qr_window = None\n self.merchant_name = self.config.get('merchant_name', 'Invoice')\n\n self.window.expert_mode = True\n self.window.receive_list.setColumnCount(5)\n self.window.receive_list.setHeaderLabels([ _('Address'), _('Label'), _('Balance'), _('Tx'), _('Request')])\n self.requested_amounts = {}\n self.toggle_QR_window(True)", "metadata": "root.Plugin.init", "header": "['class', 'Plugin', '(', 'BasePlugin', ')', ':', '___EOS___']", "index": 111 }, { "content": " def enable(self):\n if not self.config.get('use_exchange_rate'):\n self.gui.main_window.show_message(\"Please enable exchange rates first!\")\n return False\n\n return BasePlugin.enable(self)", "metadata": "root.Plugin.enable", "header": "['class', 'Plugin', '(', 'BasePlugin', ')', ':', '___EOS___']", "index": 124 }, { "content": " def load_wallet(self, wallet):\n self.wallet = wallet\n self.requested_amounts = self.wallet.storage.get('requested_amounts',{}) ", "metadata": "root.Plugin.load_wallet", "header": "['class', 'Plugin', '(', 'BasePlugin', ')', ':', '___EOS___']", "index": 132 }, { "content": " def close(self):\n self.window.receive_list.setHeaderLabels([ _('Address'), _('Label'), _('Balance'), _('Tx')])\n self.window.receive_list.setColumnCount(4)\n for i,width in enumerate(self.window.column_widths['receive']):\n self.window.receive_list.setColumnWidth(i, width)\n self.toggle_QR_window(False)", "metadata": "root.Plugin.close", "header": "['class', 'Plugin', '(', 'BasePlugin', ')', ':', '___EOS___']", "index": 136 }, { "content": " def close_main_window(self):\n if self.qr_window: \n self.qr_window.close()\n self.qr_window = None", "metadata": "root.Plugin.close_main_window", "header": "['class', 'Plugin', '(', 'BasePlugin', ')', ':', '___EOS___']", "index": 144 }, { "content": " def timer_actions(self):\n if self.qr_window:\n self.qr_window.qrw.update_qr()", "metadata": "root.Plugin.timer_actions", "header": "['class', 'Plugin', '(', 'BasePlugin', ')', ':', '___EOS___']", "index": 150 }, { "content": " def toggle_QR_window(self, show):\n if show and not self.qr_window:\n self.qr_window = QR_Window(self.gui.exchanger)\n self.qr_window.setVisible(True)\n self.qr_window_geometry = self.qr_window.geometry()\n item = self.window.receive_list.currentItem()\n if item:\n address = str(item.text(1))\n label = self.wallet.labels.get(address)\n amount, currency = self.requested_amounts.get(address, (None, None))\n self.qr_window.set_content( address, label, amount, currency )\n\n elif show and self.qr_window and not self.qr_window.isVisible():\n self.qr_window.setVisible(True)\n self.qr_window.setGeometry(self.qr_window_geometry)\n\n elif not show and self.qr_window and self.qr_window.isVisible():\n self.qr_window_geometry = self.qr_window.geometry()\n self.qr_window.setVisible(False)", "metadata": "root.Plugin.toggle_QR_window", "header": "['class', 'Plugin', '(', 'BasePlugin', ')', ':', '___EOS___']", "index": 155 }, { "content": " def update_receive_item(self, address, item):\n try:\n amount, currency = self.requested_amounts.get(address, (None, None))\n except Exception:\n print \"cannot get requested amount\", address, self.requested_amounts.get(address)\n amount, currency = None, None\n self.requested_amounts.pop(address)\n\n amount_str = amount + (' ' + currency if currency else '') if amount is not None else ''\n item.setData(column_index,0,amount_str)", "metadata": "root.Plugin.update_receive_item", "header": "['class', 'Plugin', '(', 'BasePlugin', ')', ':', '___EOS___']", "index": 177 }, { "content": " def current_item_changed(self, a):\n if not self.wallet: \n return\n if a is not None and self.qr_window and self.qr_window.isVisible():\n address = str(a.text(0))\n label = self.wallet.labels.get(address)\n try:\n amount, currency = self.requested_amounts.get(address, (None, None))\n except Exception:\n amount, currency = None, None\n self.qr_window.set_content( address, label, amount, currency )", "metadata": "root.Plugin.current_item_changed", "header": "['class', 'Plugin', '(', 'BasePlugin', ')', ':', '___EOS___']", "index": 190 }, { "content": " def item_changed(self, item, column):\n if column != column_index:\n return\n address = str( item.text(0) )\n text = str( item.text(column) )\n try:\n seq = self.wallet.get_address_index(address)\n index = seq[1][1]\n except Exception:\n print \"cannot get index\"\n return\n\n text = text.strip().upper()\n #print text\n m = re.match('^(\\d*(|\\.\\d*))\\s*(|BTC|EUR|USD|GBP|CNY|JPY|RUB|BRL)$', text)\n if m and m.group(1) and m.group(1)!='.':\n amount = m.group(1)\n currency = m.group(3)\n if not currency:\n currency = 'BTC'\n else:\n currency = currency.upper()\n \n self.requested_amounts[address] = (amount, currency)\n self.wallet.storage.put('requested_amounts', self.requested_amounts, True)\n\n label = self.wallet.labels.get(address)\n if label is None:\n label = self.merchant_name + ' - %04d'%(index+1)\n self.wallet.labels[address] = label\n\n if self.qr_window:\n self.qr_window.set_content( address, label, amount, currency )\n\n else:\n item.setText(column,'')\n if address in self.requested_amounts:\n self.requested_amounts.pop(address)\n \n self.window.update_receive_item(self.window.receive_list.currentItem())", "metadata": "root.Plugin.item_changed", "header": "['class', 'Plugin', '(', 'BasePlugin', ')', ':', '___EOS___']", "index": 204 }, { "content": " def edit_amount(self):\n l = self.window.receive_list\n item = l.currentItem()\n item.setFlags(Qt.ItemIsEditable|Qt.ItemIsSelectable | Qt.ItemIsUserCheckable | Qt.ItemIsEnabled | Qt.ItemIsDragEnabled)\n l.editItem( item, column_index )\n item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsUserCheckable | Qt.ItemIsEnabled | Qt.ItemIsDragEnabled)", "metadata": "root.Plugin.edit_amount", "header": "['class', 'Plugin', '(', 'BasePlugin', ')', ':', '___EOS___']", "index": 248 }, { "content": " def receive_menu(self, menu, addr):\n menu.addAction(_(\"Request amount\"), self.edit_amount)\n menu.addAction(_(\"Show Invoice\"), lambda: self.toggle_QR_window(True))", "metadata": "root.Plugin.receive_menu", "header": "['class', 'Plugin', '(', 'BasePlugin', ')', ':', '___EOS___']", "index": 256 } ]
[ { "span": "import PyQt4.QtGui as QtGui", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 27 }, { "span": "from electrum import bmp, pyqrnative, BasePlugin", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 48 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "platform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "decimal_", "import_", "Decimal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urllib_", "import_", "quote_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "Py", "Qt4_", "._", "Qt", "Gui_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Py", "Qt4_", "._", "Qt", "Core_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Py", "Qt4_", "._", "Qt", "Core_", "as_", "Qt", "Core_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Py", "Qt4_", "._", "Qt", "Gui_", "as_", "Qt", "Gui_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "electr", "um", "\\u", "gui_", "._", "qt_", "._", "qrc", "ode", "widget_", "import_", "QR", "Code", "Widget_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "electr", "um_", "import_", "bmp_", ",_", "pyq", "rna", "tive_", ",_", "Base", "Plugin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "electr", "um_", "._", "i18n_", "import_", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "platform_", "._", "system_", "(_", ")_", "==_", "'", "Window", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "MON", "OSP", "ACE", "\\u", "FONT_", "=_", "'", "Luc", "ida", " ", "Cons", "ole", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "platform_", "._", "system_", "(_", ")_", "==_", "'", "Dar", "win", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "MON", "OSP", "ACE", "\\u", "FONT_", "=_", "'", "Mon", "aco", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "MON", "OSP", "ACE", "\\u", "FONT_", "=_", "'", "monospace", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "column", "\\u", "index_", "=_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "QR", "\\u", "Window_", "(_", "QW", "idge", "t_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "QR", "\\u", "Window_", "(_", "QW", "idge", "t_", ")_", ":_", "\\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_", ",_", "exchange", "r_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "QW", "idge", "t_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "exchange", "r_", "=_", "exchange", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set", "Window", "Title_", "(_", "'", "Elect", "rum", " ", "-", " ", "'_", "+_", "\\u_", "(_", "'", "Invoice", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set", "Mini", "mum", "Size_", "(_", "800_", ",_", "250_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "address_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "label_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "amount_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set", "Foc", "us", "Policy_", "(_", "Qt", "Core_", "._", "Qt_", "._", "No", "Focus_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "main", "\\u", "box_", "=_", "Q", "HB", "ox", "Layout_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "qr", "w_", "=_", "QR", "Code", "Widget_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "main", "\\u", "box_", "._", "add", "Widget_", "(_", "self_", "._", "qr", "w_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "vbox_", "=_", "QV", "Box", "Layout_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "main", "\\u", "box_", "._", "add", "Layout_", "(_", "vbox_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "address", "\\u", "label_", "=_", "QL", "abel_", "(_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "address", "\\u", "label", ".", "set", "Font", "(", "QF", "ont", "(", "MON", "OSP", "ACE", "\\u", "FONT", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "vbox_", "._", "add", "Widget_", "(_", "self_", "._", "address", "\\u", "label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "label", "\\u", "label_", "=_", "QL", "abel_", "(_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vbox_", "._", "add", "Widget_", "(_", "self_", "._", "label", "\\u", "label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "amo", "unt", "\\u", "label_", "=_", "QL", "abel_", "(_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vbox_", "._", "add", "Widget_", "(_", "self_", "._", "amo", "unt", "\\u", "label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "vbox_", "._", "add", "Stretch_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set", "Layout_", "(_", "main", "\\u", "box_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "QR", "\\u", "Window_", "(_", "QW", "idge", "t_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "content_", "(_", "self_", ",_", "addr_", ",_", "label_", ",_", "amount_", ",_", "currency_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "address_", "=_", "addr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "address", "\\u", "text_", "=_", "\"<", "span", " ", "style", "='", "font", "-", "size", ":", " ", "1", "8", "pt", "'>", "%", "s", "</", "span", ">\"_", "%_", "addr_", "if_", "addr_", "else_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "address", "\\u", "label_", "._", "set", "Text_", "(_", "address", "\\u", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "currency_", "==_", "'", "BT", "C", "'_", ":_", "currency_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "amo", "unt", "\\u", "text_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "amount_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "currency_", ":_", "\\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_", "._", "amount_", "=_", "Decimal_", "(_", "amount_", ")_", "/_", "self_", "._", "exchange", "r_", "._", "exchange_", "(_", "1_", ",_", "currency_", ")_", "if_", "currency_", "else_", "amount_", "\\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_", "._", "amount_", "=_", "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 ", " _", "self_", "._", "amount_", "=_", "Decimal_", "(_", "amount_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "amount_", "=_", "self_", "._", "amount_", "._", "quantize", "_", "(_", "Decimal_", "(_", "'", "1.0000", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "currency_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "amo", "unt", "\\u", "text_", "+=_", "\"<", "span", " ", "style", "='", "font", "-", "size", ":", " ", "1", "8", "pt", "'>", "%", "s", " ", "%", "s", "</", "span", "><", "br", "/>\"_", "%_", "(_", "amount_", ",_", "currency_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "amo", "unt", "\\u", "text_", "+=_", "\"<", "span", " ", "style", "='", "font", "-", "size", ":", " ", "21", "pt", "'>", "%", "s", "</", "span", ">", " ", "<", "span", " ", "style", "='", "font", "-", "size", ":", " ", "16", "pt", "'>", "BT", "C", "</", "span", ">", " ", "\"_", "%_", "str_", "(_", "self_", "._", "amount_", ")_", "\\u\\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_", "._", "amount_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "amo", "unt", "\\u", "label_", "._", "set", "Text_", "(_", "amo", "unt", "\\u", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "label_", "=_", "label_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "label", "\\u", "text_", "=_", "\"<", "span", " ", "style", "='", "font", "-", "size", ":", " ", "21", "pt", "'>", "%", "s", "</", "span", ">\"_", "%_", "label_", "if_", "label_", "else_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "label", "\\u", "label_", "._", "set", "Text_", "(_", "label", "\\u", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "=_", "'", "bitcoin", ":'_", "+_", "self_", "._", "address_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "amount_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "+=_", "'?", "amo", "unt", "=", "%", "s", "'_", "%_", "(_", "str_", "(_", "self_", "._", "amount_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "label_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "encode", "d\\u", "label_", "=_", "quote_", "(_", "self_", "._", "label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "+=_", "'&", "label", "=", "%", "s", "'_", "%_", "(_", "encode", "d\\u", "label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "label_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "encode", "d\\u", "label_", "=_", "quote_", "(_", "self_", "._", "label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "+=_", "'?", "label", "=", "%", "s", "'_", "%_", "(_", "encode", "d\\u", "label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "qr", "w_", "._", "set\\u", "addr_", "(_", "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_", "class_", "Plugin_", "(_", "Base", "Plugin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Plugin_", "(_", "Base", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "fullname_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "Point", " ", "of", " ", "Sal", "e", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Plugin_", "(_", "Base", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "description_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u_", "(_", "'", "Show", " ", "QR", " ", "code", " ", "window", " ", "and", " ", "amounts", " ", "request", "ed", " ", "for", " ", "each", " ", "address", ".", " ", "Add", " ", "menu", " ", "item", " ", "to", " ", "request", " ", "amo", "unt", ".'_", ")_", "+_", "\\u_", "(_", "'", " ", "Not", "e", ":", " ", "Thi", "s", " ", "require", "s", " ", "the", " ", "exchange", " ", "rate", " ", "plugin", " ", "to", " ", "be", " ", "install", "ed", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Plugin_", "(_", "Base", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "init_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "window_", "=_", "self_", "._", "gui_", "._", "main", "\\u", "window_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wallet_", "=_", "self_", "._", "window_", "._", "wallet_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "qr", "\\u", "window_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "merchant", "\\u", "name_", "=_", "self_", "._", "config_", "._", "get_", "(_", "'", "merchant", "\\u", "name", "'_", ",_", "'", "Invoice", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "window_", "._", "expert", "\\u", "mode_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "window_", "._", "receive", "\\u", "list_", "._", "set", "Colum", "n", "Count_", "(_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "window_", "._", "receive", "\\u", "list_", "._", "set", "Head", "er", "Labels_", "(_", "[_", "\\u_", "(_", "'", "Address", "'_", ")_", ",_", "\\u_", "(_", "'", "Label", "'_", ")_", ",_", "\\u_", "(_", "'", "Balance", "'_", ")_", ",_", "\\u_", "(_", "'", "Tx", "'_", ")_", ",_", "\\u_", "(_", "'", "Request", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "request", "ed", "\\u", "amounts", "_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "toggle", "\\u", "QR", "\\u", "window_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Plugin_", "(_", "Base", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "enable_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "config_", "._", "get_", "(_", "'", "use", "\\u", "exchange", "\\u", "rate", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "gui_", "._", "main", "\\u", "window_", "._", "show", "\\u", "message_", "(_", "\"", "Ple", "ase", " ", "enable", " ", "exchange", " ", "rate", "s", " ", "first", "!\"_", ")_", "\\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_", "return_", "Base", "Plugin_", "._", "enable_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Plugin_", "(_", "Base", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load", "\\u", "wallet_", "(_", "self_", ",_", "wallet_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "wallet_", "=_", "wallet_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "request", "ed", "\\u", "amounts", "_", "=_", "self_", "._", "wallet_", "._", "storage_", "._", "get_", "(_", "'", "request", "ed", "\\u", "amounts", "'_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Plugin_", "(_", "Base", "Plugin_", ")_", ":_", "\\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 ", " _", "self_", "._", "window_", "._", "receive", "\\u", "list_", "._", "set", "Head", "er", "Labels_", "(_", "[_", "\\u_", "(_", "'", "Address", "'_", ")_", ",_", "\\u_", "(_", "'", "Label", "'_", ")_", ",_", "\\u_", "(_", "'", "Balance", "'_", ")_", ",_", "\\u_", "(_", "'", "Tx", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "window_", "._", "receive", "\\u", "list_", "._", "set", "Colum", "n", "Count_", "(_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "width_", "in_", "enumerate_", "(_", "self_", "._", "window_", "._", "column", "\\u", "widths_", "[_", "'", "receive", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "window_", "._", "receive", "\\u", "list_", "._", "set", "Colum", "n", "Width_", "(_", "i_", ",_", "width_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "toggle", "\\u", "QR", "\\u", "window_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Plugin_", "(_", "Base", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "close", "\\u", "main", "\\u", "window_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "qr", "\\u", "window_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "qr", "\\u", "window_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "qr", "\\u", "window_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Plugin_", "(_", "Base", "Plugin_", ")_", ":_", "\\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_", "timer", "\\u", "actions_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "qr", "\\u", "window_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "qr", "\\u", "window_", "._", "qr", "w_", "._", "update", "\\u", "qr_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Plugin_", "(_", "Base", "Plugin_", ")_", ":_", "\\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_", "toggle", "\\u", "QR", "\\u", "window_", "(_", "self_", ",_", "show_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "show_", "and_", "not_", "self_", "._", "qr", "\\u", "window_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "qr", "\\u", "window_", "=_", "QR", "\\u", "Window_", "(_", "self_", "._", "gui_", "._", "exchange", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "qr", "\\u", "window_", "._", "set", "Visible_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "qr", "\\u", "window", "\\u", "geometry_", "=_", "self_", "._", "qr", "\\u", "window_", "._", "geometry_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "item_", "=_", "self_", "._", "window_", "._", "receive", "\\u", "list_", "._", "current", "Item_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "item_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "address_", "=_", "str_", "(_", "item_", "._", "text_", "(_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "label_", "=_", "self_", "._", "wallet_", "._", "labels_", "._", "get_", "(_", "address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "amount_", ",_", "currency_", "=_", "self_", "._", "request", "ed", "\\u", "amounts", "_", "._", "get_", "(_", "address_", ",_", "(_", "None_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "qr", "\\u", "window_", "._", "set\\u", "content_", "(_", "address_", ",_", "label_", ",_", "amount_", ",_", "currency_", ")_", "\\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_", "show_", "and_", "self_", "._", "qr", "\\u", "window_", "and_", "not_", "self_", "._", "qr", "\\u", "window_", "._", "is", "Visible_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "qr", "\\u", "window_", "._", "set", "Visible_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "qr", "\\u", "window_", "._", "set", "Geometry_", "(_", "self_", "._", "qr", "\\u", "window", "\\u", "geometry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "show_", "and_", "self_", "._", "qr", "\\u", "window_", "and_", "self_", "._", "qr", "\\u", "window_", "._", "is", "Visible_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "qr", "\\u", "window", "\\u", "geometry_", "=_", "self_", "._", "qr", "\\u", "window_", "._", "geometry_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "qr", "\\u", "window_", "._", "set", "Visible_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Plugin_", "(_", "Base", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "receive", "\\u", "item_", "(_", "self_", ",_", "address_", ",_", "item_", ")_", ":_", "\\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 ", " _", "amount_", ",_", "currency_", "=_", "self_", "._", "request", "ed", "\\u", "amounts", "_", "._", "get_", "(_", "address_", ",_", "(_", "None_", ",_", "None_", ")_", ")_", "\\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 ", " _", "print_", "\"", "cann", "ot", " ", "get", " ", "request", "ed", " ", "amo", "unt", "\"_", ",_", "address_", ",_", "self_", "._", "request", "ed", "\\u", "amounts", "_", "._", "get_", "(_", "address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "amount_", ",_", "currency_", "=_", "None_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "request", "ed", "\\u", "amounts", "_", "._", "pop_", "(_", "address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "amo", "unt", "\\u", "str_", "=_", "amount_", "+_", "(_", "'", " ", "'_", "+_", "currency_", "if_", "currency_", "else_", "''_", ")_", "if_", "amount_", "is_", "not_", "None_", "else_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "item_", "._", "set", "Data_", "(_", "column", "\\u", "index_", ",_", "0_", ",_", "amo", "unt", "\\u", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Plugin_", "(_", "Base", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "current", "\\u", "item", "\\u", "changed_", "(_", "self_", ",_", "a_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "wallet_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "a_", "is_", "not_", "None_", "and_", "self_", "._", "qr", "\\u", "window_", "and_", "self_", "._", "qr", "\\u", "window_", "._", "is", "Visible_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "address_", "=_", "str_", "(_", "a_", "._", "text_", "(_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "label_", "=_", "self_", "._", "wallet_", "._", "labels_", "._", "get_", "(_", "address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "amount_", ",_", "currency_", "=_", "self_", "._", "request", "ed", "\\u", "amounts", "_", "._", "get_", "(_", "address_", ",_", "(_", "None_", ",_", "None_", ")_", ")_", "\\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 ", " _", "amount_", ",_", "currency_", "=_", "None_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "qr", "\\u", "window_", "._", "set\\u", "content_", "(_", "address_", ",_", "label_", ",_", "amount_", ",_", "currency_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Plugin_", "(_", "Base", "Plugin_", ")_", ":_", "\\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_", "item", "\\u", "changed_", "(_", "self_", ",_", "item_", ",_", "column_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "column_", "!=_", "column", "\\u", "index_", ":_", "\\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_", "address_", "=_", "str_", "(_", "item_", "._", "text_", "(_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "str_", "(_", "item_", "._", "text_", "(_", "column_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "seq_", "=_", "self_", "._", "wallet_", "._", "get", "\\u", "address", "\\u", "index_", "(_", "address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index_", "=_", "seq_", "[_", "1_", "]_", "[_", "1_", "]_", "\\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 ", " _", "print_", "\"", "cann", "ot", " ", "get", " ", "index", "\"_", "\\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_", "text_", "=_", "text_", "._", "strip_", "(_", ")_", "._", "upper_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "text_", "\\u\\u\\uNL\\u\\u\\u_", "m_", "=_", "re_", "._", "match_", "(_", "'", "^", "(\\\\", "d", "*(", "|\\\\", ".\\\\", "d", "*)", ")\\\\", "s", "*(", "|", "BT", "C", "|", "EU", "R", "|", "US", "D", "|", "GB", "P", "|", "CN", "Y", "|", "JP", "Y", "|", "RU", "B", "|", "BR", "L", ")$'_", ",_", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m_", "and_", "m_", "._", "group_", "(_", "1_", ")_", "and_", "m_", "._", "group_", "(_", "1_", ")_", "!=_", "'.'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "amount_", "=_", "m_", "._", "group_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "currency_", "=_", "m_", "._", "group_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "currency_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "currency_", "=_", "'", "BT", "C", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "currency_", "=_", "currency_", "._", "upper_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "request", "ed", "\\u", "amounts", "_", "[_", "address_", "]_", "=_", "(_", "amount_", ",_", "currency_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wallet_", "._", "storage_", "._", "put_", "(_", "'", "request", "ed", "\\u", "amounts", "'_", ",_", "self_", "._", "request", "ed", "\\u", "amounts", "_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "self_", "._", "wallet_", "._", "labels_", "._", "get_", "(_", "address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "label_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "label_", "=_", "self_", "._", "merchant", "\\u", "name_", "+_", "'", " ", "-", " ", "%", "04", "d", "'_", "%_", "(_", "index_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wallet_", "._", "labels_", "[_", "address_", "]_", "=_", "label_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "qr", "\\u", "window_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "qr", "\\u", "window_", "._", "set\\u", "content_", "(_", "address_", ",_", "label_", ",_", "amount_", ",_", "currency_", ")_", "\\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 ", " _", "item_", "._", "set", "Text_", "(_", "column_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "address_", "in_", "self_", "._", "request", "ed", "\\u", "amounts", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "request", "ed", "\\u", "amounts", "_", "._", "pop_", "(_", "address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "window_", "._", "update", "\\u", "receive", "\\u", "item_", "(_", "self_", "._", "window_", "._", "receive", "\\u", "list_", "._", "current", "Item_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Plugin_", "(_", "Base", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "edit", "\\u", "amount_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "l_", "=_", "self_", "._", "window_", "._", "receive", "\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "item_", "=_", "l_", "._", "current", "Item_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "item_", "._", "set", "Flags_", "(_", "Qt_", "._", "Item", "Is", "Editable", "_", "|_", "Qt_", "._", "Item", "Is", "Select", "able_", "|_", "Qt_", "._", "Item", "Is", "User", "Checkable", "_", "|_", "Qt_", "._", "Item", "Is", "Enabled_", "|_", "Qt_", "._", "Item", "Is", "Drag", "Enabled_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l_", "._", "edit", "Item_", "(_", "item_", ",_", "column", "\\u", "index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "item_", "._", "set", "Flags_", "(_", "Qt_", "._", "Item", "Is", "Select", "able_", "|_", "Qt_", "._", "Item", "Is", "User", "Checkable", "_", "|_", "Qt_", "._", "Item", "Is", "Enabled_", "|_", "Qt_", "._", "Item", "Is", "Drag", "Enabled_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Plugin_", "(_", "Base", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "receive", "\\u", "menu_", "(_", "self_", ",_", "menu_", ",_", "addr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "menu_", "._", "add", "Action_", "(_", "\\u_", "(_", "\"", "Request", " ", "amo", "unt", "\"_", ")_", ",_", "self_", "._", "edit", "\\u", "amount_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "menu_", "._", "add", "Action_", "(_", "\\u_", "(_", "\"", "Show", " ", "Invoice", "\"_", ")_", ",_", "lambda_", ":_", "self_", "._", "toggle", "\\u", "QR", "\\u", "window_", "(_", "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, 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, 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,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Non-standard exception raised in special method
katharosada/botchallenge/client/google/protobuf/internal/cpp_message.py
[ { "content": " def __hash__(self):\n raise TypeError('unhashable object')", "metadata": "root.RepeatedScalarContainer.__hash__", "header": "['class', 'RepeatedScalarContainer', '(', 'object', ')', ':', '___EOS___']", "index": 158 }, { "content": " def __hash__(self):\n raise TypeError('unhashable object')", "metadata": "root.RepeatedCompositeContainer.__hash__", "header": "['class', 'RepeatedCompositeContainer', '(', 'object', ')', ':', '___EOS___']", "index": 246 } ]
[ { "span": "def __hash__(self):", "start_line": 158, "start_column": 2, "end_line": 158, "end_column": 21 }, { "span": "def __hash__(self):", "start_line": 246, "start_column": 2, "end_line": 246, "end_column": 21 } ]
[]
1
true
[ "[CLS]_", "Non", "_", "-_", "standard_", "exception_", "raised_", "in_", "special_", "method_", "[SEP]_", "class_", "Repeat", "ed", "Scala", "r", "Container_", "(_", "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 ", " _", "raise_", "Type", "Error_", "(_", "'", "unh", "ash", "able", " ", "object", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Repeat", "ed", "Composit", "e", "Container_", "(_", "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 ", " _", "raise_", "Type", "Error_", "(_", "'", "unh", "ash", "able", " ", "object", "'_", ")_", "\\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, 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, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
deanmalmgren/flo/flo/shell.py
[ { "content": "\"\"\"Module for executing commands on the command line\n\"\"\"\nimport subprocess\nimport sys\nimport threading\n\nfrom . import exceptions\nfrom . import logger as flo_logger\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def log_output(stream, block_size=1):\n \"\"\"This function logs the output from the subprocess'ed command by\n reading the output stream in small blocks of size `block_size`\n bytes to properly handle backspacing outputs (issue #53)\n \"\"\"\n logger = flo_logger.get()\n while True:\n data = stream.read(block_size)\n if not data:\n break\n logger.write(data)\n stream.close()", "metadata": "root.log_output", "header": "['module', '___EOS___']", "index": 10 }, { "content": "def run(directory, command):\n \"\"\"Run the specified shell command using Fabric-like behavior.\"\"\"\n\n # combine stderr and stdout output when running command so we can\n # stream output to the logger for output to terminal and file\n # simultaneously\n wrapped_command = \"cd %s && %s\" % (directory, command)\n pipe = subprocess.Popen(\n wrapped_command, shell=True,\n stdout=subprocess.PIPE, stderr=subprocess.STDOUT,\n )\n\n # this uses threading to capture the output in real time in a\n # non-blocking way and use the log_output function to report the\n # output using the logging module. This framework takes\n # inspiration from http://stackoverflow.com/a/4985080/564709\n thread = threading.Thread(target=log_output, args=(pipe.stdout,))\n thread.daemon = True\n thread.start()\n thread.join()\n pipe.wait()\n\n # if pipe is busted, raise an error\n if pipe.returncode != 0:\n raise exceptions.ShellError(pipe.returncode)", "metadata": "root.run", "header": "['module', '___EOS___']", "index": 24 } ]
[ { "span": "import sys", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 10 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "Modul", "e", " ", "for", " ", "executi", "ng", " ", "command", "s", " ", "on", " ", "the", " ", "command", " ", "line", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "threading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "import_", "exceptions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "import_", "logger_", "as_", "flo", "\\u", "logger_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "log", "\\u", "output_", "(_", "stream_", ",_", "block", "\\u", "size_", "=_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Thi", "s", " ", "function", " ", "logs", " ", "the", " ", "output", " ", "from", " ", "the", " ", "subproc", "ess", "'", "ed", " ", "command", " ", "by", "\\", "10", ";", " ", " ", " ", " ", "readi", "ng", " ", "the", " ", "output", " ", "stream", " ", "in", " ", "small", " ", "blocks", " ", "of", " ", "size", " ", "`", "block", "\\u", "size", "`", "\\", "10", ";", " ", " ", " ", " ", "bytes", " ", "to", " ", "proper", "ly", " ", "handle", " ", "backs", "pacing", " ", "output", "s", " ", "(", "issue", " ", "#", "5", "3", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "=_", "flo", "\\u", "logger_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "stream_", "._", "read_", "(_", "block", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logger_", "._", "write_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "stream_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", "directory_", ",_", "command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Run", " ", "the", " ", "specified", " ", "shell", " ", "command", " ", "usi", "ng", " ", "Fabric", "-", "like", " ", "behavior", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "combin", "e", " ", "std", "err", " ", "and", " ", "stdout", " ", "output", " ", "whe", "n", " ", "runn", "ing", " ", "command", " ", "so", " ", "we", " ", "can_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "stream", " ", "output", " ", "to", " ", "the", " ", "logg", "er", " ", "for", " ", "output", " ", "to", " ", "termina", "l", " ", "and", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "simultaneous", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "wrapp", "ed", "\\u", "command_", "=_", "\"", "cd", " ", "%", "s", " ", "&&", " ", "%", "s", "\"_", "%_", "(_", "directory_", ",_", "command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pipe_", "=_", "subprocess_", "._", "Popen_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "wrapp", "ed", "\\u", "command_", ",_", "shell_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stdout_", "=_", "subprocess_", "._", "PIPE_", ",_", "stderr_", "=_", "subprocess_", "._", "STDOUT_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "use", "s", " ", "thread", "ing", " ", "to", " ", "captur", "e", " ", "the", " ", "output", " ", "in", " ", "real", " ", "time", " ", "in", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "non", "-", "blockin", "g", " ", "way", " ", "and", " ", "use", " ", "the", " ", "log", "\\u", "output", " ", "function", " ", "to", " ", "report", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "output", " ", "usi", "ng", " ", "the", " ", "logg", "ing", " ", "module", ".", " ", "Thi", "s", " ", "frame", "work", " ", "take", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "insp", "irat", "ion", " ", "from", " ", "http", "://", "stack", "overflow", ".", "com", "/", "a", "/", "498", "508", "0", "/", "564", "709", "_", "\\u\\u\\uNL\\u\\u\\u_", "thread_", "=_", "threading_", "._", "Thread_", "(_", "target_", "=_", "log", "\\u", "output_", ",_", "args_", "=_", "(_", "pipe_", "._", "stdout_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thread_", "._", "daemon_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thread_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thread_", "._", "join_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pipe_", "._", "wait_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "pipe", " ", "is", " ", "bust", "ed", ",", " ", "raise", " ", "an", " ", "error_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "pipe_", "._", "returncode_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exceptions_", "._", "Shel", "l", "Error_", "(_", "pipe_", "._", "returncode_", ")_" ]
[ 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, 2, 2, 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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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 ]
Variable defined multiple times
mtth/hdfs/test/test_client.py
[ { "content": " def test_with_selection(self):\n fnames = ['part-m-00000.avro', 'part-m-00001.avro']\n self.client.write(psp.join('foo', '.header'), 'metadata')\n self.client.write(psp.join('foo', fnames[0]), 'first')\n self.client.write(psp.join('foo', fnames[1]), 'second')\n parts = self.client.parts('foo', parts=1)\n eq_(len(parts), 1)\n ok_(parts[0] in fnames)", "metadata": "root.TestParts.test_with_selection", "header": "['class', 'TestParts', '(', '_IntegrationTest', ')', ':', '___EOS___']", "index": 1031 }, { "content": " def test_with_selection(self):\n fnames = ['part-m-00000.avro', 'part-m-00001.avro']\n self.client.write(psp.join('foo', '.header'), 'metadata')\n self.client.write(psp.join('foo', fnames[0]), 'first')\n self.client.write(psp.join('foo', fnames[1]), 'second')\n eq_(self.client.parts('foo', parts=[1]), fnames[1:])", "metadata": "root.TestParts.test_with_selection", "header": "['class', 'TestParts', '(', '_IntegrationTest', ')', ':', '___EOS___']", "index": 1040 } ]
[ { "span": "test_with_selection(", "start_line": 1031, "start_column": 6, "end_line": 1031, "end_column": 25 } ]
[ { "span": "test_with_selection(", "start_line": 1040, "start_column": 6, "end_line": 1040, "end_column": 25 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Test", "Parts_", "(_", "\\u", "Integrati", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "with", "\\u", "selection_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fnames_", "=_", "[_", "'", "part", "-", "m", "-0", "0000", ".", "avro", "'_", ",_", "'", "part", "-", "m", "-0", "0001", ".", "avro", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "client_", "._", "write_", "(_", "psp", "_", "._", "join_", "(_", "'", "foo", "'_", ",_", "'.", "header", "'_", ")_", ",_", "'", "metadata", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "client_", "._", "write_", "(_", "psp", "_", "._", "join_", "(_", "'", "foo", "'_", ",_", "fnames_", "[_", "0_", "]_", ")_", ",_", "'", "first", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "client_", "._", "write_", "(_", "psp", "_", "._", "join_", "(_", "'", "foo", "'_", ",_", "fnames_", "[_", "1_", "]_", ")_", ",_", "'", "second", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parts_", "=_", "self_", "._", "client_", "._", "parts_", "(_", "'", "foo", "'_", ",_", "parts_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "len_", "(_", "parts_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ok\\u_", "(_", "parts_", "[_", "0_", "]_", "in_", "fnames_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Parts_", "(_", "\\u", "Integrati", "on", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "with", "\\u", "selection_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fnames_", "=_", "[_", "'", "part", "-", "m", "-0", "0000", ".", "avro", "'_", ",_", "'", "part", "-", "m", "-0", "0001", ".", "avro", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "client_", "._", "write_", "(_", "psp", "_", "._", "join_", "(_", "'", "foo", "'_", ",_", "'.", "header", "'_", ")_", ",_", "'", "metadata", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "client_", "._", "write_", "(_", "psp", "_", "._", "join_", "(_", "'", "foo", "'_", ",_", "fnames_", "[_", "0_", "]_", ")_", ",_", "'", "first", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "client_", "._", "write_", "(_", "psp", "_", "._", "join_", "(_", "'", "foo", "'_", ",_", "fnames_", "[_", "1_", "]_", ")_", ",_", "'", "second", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "self_", "._", "client_", "._", "parts_", "(_", "'", "foo", "'_", ",_", "parts_", "=_", "[_", "1_", "]_", ")_", ",_", "fnames_", "[_", "1_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 3, 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 ]
Unused import
scieloorg/scielo-manager/scielomanager/journalmanager/migrations/0015_fix_nulls_in_init_vol.py
[ { "content": "# -*- coding: utf-8 -*-\nfrom south.utils import datetime_utils as datetime\nfrom south.db import db\nfrom south.v2 import DataMigration\nfrom django.db import models\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Migration(DataMigration):\n\n\n\n models = {\n 'auth.group': {\n 'Meta': {'object_name': 'Group'},\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),\n 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': \"orm['auth.Permission']\", 'symmetrical': 'False', 'blank': 'True'})\n },\n 'auth.permission': {\n 'Meta': {'ordering': \"('content_type__app_label', 'content_type__model', 'codename')\", 'unique_together': \"(('content_type', 'codename'),)\", 'object_name': 'Permission'},\n 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['contenttypes.ContentType']\"}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})\n },\n 'auth.user': {\n 'Meta': {'object_name': 'User'},\n 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),\n 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),\n 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),\n 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': \"orm['auth.Group']\", 'symmetrical': 'False', 'blank': 'True'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),\n 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),\n 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),\n 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),\n 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': \"orm['auth.Permission']\", 'symmetrical': 'False', 'blank': 'True'}),\n 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})\n },\n 'contenttypes.contenttype': {\n 'Meta': {'ordering': \"('name',)\", 'unique_together': \"(('app_label', 'model'),)\", 'object_name': 'ContentType', 'db_table': \"'django_content_type'\"},\n 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})\n },\n 'journalmanager.aheadpressrelease': {\n 'Meta': {'object_name': 'AheadPressRelease', '_ormbases': ['journalmanager.PressRelease']},\n 'journal': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"'press_releases'\", 'to': \"orm['journalmanager.Journal']\"}),\n 'pressrelease_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': \"orm['journalmanager.PressRelease']\", 'unique': 'True', 'primary_key': 'True'})\n },\n 'journalmanager.article': {\n 'Meta': {'object_name': 'Article'},\n 'aid': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '32'}),\n 'article_type': ('django.db.models.fields.CharField', [], {'max_length': '32', 'db_index': 'True'}),\n 'articles_linkage_is_pending': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'created_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'auto_now_add': 'True', 'blank': 'True'}),\n 'doi': ('django.db.models.fields.CharField', [], {'default': \"u''\", 'max_length': '2048', 'db_index': 'True'}),\n 'domain_key': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '2048', 'db_index': 'False'}),\n 'es_is_dirty': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),\n 'es_updated_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'is_aop': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'is_visible': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),\n 'issn_epub': ('django.db.models.fields.CharField', [], {'max_length': '9', 'db_index': 'True'}),\n 'issn_ppub': ('django.db.models.fields.CharField', [], {'max_length': '9', 'db_index': 'True'}),\n 'issue': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': \"'articles'\", 'null': 'True', 'to': \"orm['journalmanager.Issue']\"}),\n 'journal': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': \"'articles'\", 'null': 'True', 'to': \"orm['journalmanager.Journal']\"}),\n 'journal_title': ('django.db.models.fields.CharField', [], {'max_length': '512', 'db_index': 'True'}),\n 'related_articles': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': \"orm['journalmanager.Article']\", 'null': 'True', 'through': \"orm['journalmanager.ArticlesLinkage']\", 'blank': 'True'}),\n 'updated_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'auto_now': 'True', 'blank': 'True'}),\n 'xml': ('scielomanager.custom_fields.XMLSPSField', [], {}),\n 'xml_version': ('django.db.models.fields.CharField', [], {'max_length': '9'})\n },\n 'journalmanager.articleslinkage': {\n 'Meta': {'object_name': 'ArticlesLinkage'},\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'link_to': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"'referrers'\", 'to': \"orm['journalmanager.Article']\"}),\n 'link_type': ('django.db.models.fields.CharField', [], {'max_length': '32'}),\n 'referrer': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"'links_to'\", 'to': \"orm['journalmanager.Article']\"})\n },\n 'journalmanager.collection': {\n 'Meta': {'ordering': \"['name']\", 'object_name': 'Collection'},\n 'acronym': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '16', 'blank': 'True'}),\n 'address': ('django.db.models.fields.TextField', [], {}),\n 'address_complement': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'}),\n 'address_number': ('django.db.models.fields.CharField', [], {'max_length': '8'}),\n 'city': ('django.db.models.fields.CharField', [], {'max_length': '32', 'blank': 'True'}),\n 'collection': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': \"'user_collection'\", 'to': \"orm['auth.User']\", 'through': \"orm['journalmanager.UserCollections']\", 'blank': 'True', 'symmetrical': 'False', 'null': 'True'}),\n 'country': ('django.db.models.fields.CharField', [], {'max_length': '32'}),\n 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75'}),\n 'fax': ('django.db.models.fields.CharField', [], {'max_length': '16', 'blank': 'True'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'logo': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}),\n 'name_slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'unique': 'True', 'null': 'True', 'blank': 'True'}),\n 'phone': ('django.db.models.fields.CharField', [], {'max_length': '16', 'blank': 'True'}),\n 'state': ('django.db.models.fields.CharField', [], {'max_length': '32', 'blank': 'True'}),\n 'url': ('django.db.models.fields.URLField', [], {'max_length': '200'}),\n 'zip_code': ('django.db.models.fields.CharField', [], {'max_length': '16', 'null': 'True', 'blank': 'True'})\n },\n 'journalmanager.institution': {\n 'Meta': {'ordering': \"['name']\", 'object_name': 'Institution'},\n 'acronym': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '16', 'blank': 'True'}),\n 'address': ('django.db.models.fields.TextField', [], {}),\n 'address_complement': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'}),\n 'address_number': ('django.db.models.fields.CharField', [], {'max_length': '8'}),\n 'cel': ('django.db.models.fields.CharField', [], {'max_length': '16', 'blank': 'True'}),\n 'city': ('django.db.models.fields.CharField', [], {'max_length': '32', 'blank': 'True'}),\n 'complement': ('django.db.models.fields.TextField', [], {'default': \"''\", 'blank': 'True'}),\n 'country': ('django.db.models.fields.CharField', [], {'max_length': '32'}),\n 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),\n 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75'}),\n 'fax': ('django.db.models.fields.CharField', [], {'max_length': '16', 'blank': 'True'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'is_trashed': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '256', 'db_index': 'True'}),\n 'phone': ('django.db.models.fields.CharField', [], {'max_length': '16', 'blank': 'True'}),\n 'state': ('django.db.models.fields.CharField', [], {'max_length': '32', 'blank': 'True'}),\n 'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),\n 'zip_code': ('django.db.models.fields.CharField', [], {'max_length': '16', 'null': 'True', 'blank': 'True'})\n },\n 'journalmanager.issue': {\n 'Meta': {'ordering': \"('created', 'id')\", 'object_name': 'Issue'},\n 'cover': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),\n 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),\n 'ctrl_vocabulary': ('django.db.models.fields.CharField', [], {'max_length': '64', 'blank': 'True'}),\n 'editorial_standard': ('django.db.models.fields.CharField', [], {'max_length': '64'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'is_marked_up': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'is_trashed': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}),\n 'journal': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['journalmanager.Journal']\"}),\n 'label': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '64', 'null': 'True', 'blank': 'True'}),\n 'number': ('django.db.models.fields.CharField', [], {'max_length': '16', 'blank': 'True'}),\n 'order': ('django.db.models.fields.IntegerField', [], {'blank': 'True'}),\n 'publication_end_month': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),\n 'publication_start_month': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),\n 'publication_year': ('django.db.models.fields.IntegerField', [], {}),\n 'section': ('django.db.models.fields.related.ManyToManyField', [], {'to': \"orm['journalmanager.Section']\", 'symmetrical': 'False', 'blank': 'True'}),\n 'spe_text': ('django.db.models.fields.CharField', [], {'max_length': '15', 'null': 'True', 'blank': 'True'}),\n 'suppl_text': ('django.db.models.fields.CharField', [], {'max_length': '15', 'null': 'True', 'blank': 'True'}),\n 'total_documents': ('django.db.models.fields.IntegerField', [], {'default': '0'}),\n 'type': ('django.db.models.fields.CharField', [], {'default': \"'regular'\", 'max_length': '15'}),\n 'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),\n 'use_license': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['journalmanager.UseLicense']\", 'null': 'True'}),\n 'volume': ('django.db.models.fields.CharField', [], {'max_length': '16', 'blank': 'True'})\n },\n 'journalmanager.issuetitle': {\n 'Meta': {'object_name': 'IssueTitle'},\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'issue': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['journalmanager.Issue']\"}),\n 'language': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['journalmanager.Language']\"}),\n 'title': ('django.db.models.fields.CharField', [], {'max_length': '256'})\n },\n 'journalmanager.journal': {\n 'Meta': {'ordering': \"('title', 'id')\", 'object_name': 'Journal'},\n 'abstract_keyword_languages': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': \"'abstract_keyword_languages'\", 'symmetrical': 'False', 'to': \"orm['journalmanager.Language']\"}),\n 'acronym': ('django.db.models.fields.CharField', [], {'max_length': '16'}),\n 'ccn_code': ('django.db.models.fields.CharField', [], {'default': \"''\", 'max_length': '64', 'blank': 'True'}),\n 'collections': ('django.db.models.fields.related.ManyToManyField', [], {'to': \"orm['journalmanager.Collection']\", 'through': \"orm['journalmanager.Membership']\", 'symmetrical': 'False'}),\n 'copyrighter': ('django.db.models.fields.CharField', [], {'max_length': '254'}),\n 'cover': ('scielomanager.custom_fields.ContentTypeRestrictedFileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),\n 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),\n 'creator': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"'enjoy_creator'\", 'to': \"orm['auth.User']\"}),\n 'ctrl_vocabulary': ('django.db.models.fields.CharField', [], {'max_length': '64'}),\n 'current_ahead_documents': ('django.db.models.fields.IntegerField', [], {'default': '0', 'max_length': '3', 'null': 'True', 'blank': 'True'}),\n 'editor': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': \"'editor_journal'\", 'null': 'True', 'to': \"orm['auth.User']\"}),\n 'editor_address': ('django.db.models.fields.CharField', [], {'max_length': '512'}),\n 'editor_address_city': ('django.db.models.fields.CharField', [], {'max_length': '256'}),\n 'editor_address_country': ('scielo_extensions.modelfields.CountryField', [], {'max_length': '2'}),\n 'editor_address_state': ('django.db.models.fields.CharField', [], {'max_length': '128'}),\n 'editor_address_zip': ('django.db.models.fields.CharField', [], {'max_length': '64'}),\n 'editor_email': ('django.db.models.fields.EmailField', [], {'max_length': '75'}),\n 'editor_name': ('django.db.models.fields.CharField', [], {'max_length': '512'}),\n 'editor_phone1': ('django.db.models.fields.CharField', [], {'max_length': '32'}),\n 'editor_phone2': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True', 'blank': 'True'}),\n 'editorial_standard': ('django.db.models.fields.CharField', [], {'max_length': '64'}),\n 'eletronic_issn': ('django.db.models.fields.CharField', [], {'max_length': '9', 'db_index': 'True'}),\n 'final_num': ('django.db.models.fields.CharField', [], {'max_length': '16', 'blank': 'True'}),\n 'final_vol': ('django.db.models.fields.CharField', [], {'max_length': '16', 'blank': 'True'}),\n 'final_year': ('django.db.models.fields.CharField', [], {'max_length': '4', 'null': 'True', 'blank': 'True'}),\n 'frequency': ('django.db.models.fields.CharField', [], {'max_length': '16'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'index_coverage': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),\n 'init_num': ('django.db.models.fields.CharField', [], {'max_length': '16', 'null': 'True', 'blank': 'True'}),\n 'init_vol': ('django.db.models.fields.CharField', [], {'max_length': '16', 'null': 'True', 'blank': 'True'}),\n 'init_year': ('django.db.models.fields.CharField', [], {'max_length': '4'}),\n 'is_indexed_aehci': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'is_indexed_scie': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'is_indexed_ssci': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'is_trashed': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}),\n 'languages': ('django.db.models.fields.related.ManyToManyField', [], {'to': \"orm['journalmanager.Language']\", 'symmetrical': 'False'}),\n 'logo': ('scielomanager.custom_fields.ContentTypeRestrictedFileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),\n 'medline_code': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True', 'blank': 'True'}),\n 'medline_title': ('django.db.models.fields.CharField', [], {'max_length': '256', 'null': 'True', 'blank': 'True'}),\n 'notes': ('django.db.models.fields.TextField', [], {'max_length': '254', 'null': 'True', 'blank': 'True'}),\n 'other_previous_title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),\n 'previous_ahead_documents': ('django.db.models.fields.IntegerField', [], {'default': '0', 'max_length': '3', 'null': 'True', 'blank': 'True'}),\n 'previous_title': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': \"'prev_title'\", 'null': 'True', 'to': \"orm['journalmanager.Journal']\"}),\n 'print_issn': ('django.db.models.fields.CharField', [], {'max_length': '9', 'db_index': 'True'}),\n 'pub_level': ('django.db.models.fields.CharField', [], {'max_length': '64'}),\n 'publication_city': ('django.db.models.fields.CharField', [], {'max_length': '64'}),\n 'publisher_country': ('scielo_extensions.modelfields.CountryField', [], {'max_length': '2'}),\n 'publisher_name': ('django.db.models.fields.CharField', [], {'max_length': '256'}),\n 'publisher_state': ('django.db.models.fields.CharField', [], {'max_length': '64'}),\n 'scielo_issn': ('django.db.models.fields.CharField', [], {'max_length': '16'}),\n 'secs_code': ('django.db.models.fields.CharField', [], {'max_length': '64', 'blank': 'True'}),\n 'short_title': ('django.db.models.fields.CharField', [], {'max_length': '256', 'null': 'True', 'db_index': 'True'}),\n 'sponsor': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': \"'journal_sponsor'\", 'null': 'True', 'symmetrical': 'False', 'to': \"orm['journalmanager.Sponsor']\"}),\n 'study_areas': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': \"'journals_migration_tmp'\", 'null': 'True', 'to': \"orm['journalmanager.StudyArea']\"}),\n 'subject_categories': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': \"'journals'\", 'null': 'True', 'to': \"orm['journalmanager.SubjectCategory']\"}),\n 'subject_descriptors': ('django.db.models.fields.CharField', [], {'max_length': '1024'}),\n 'title': ('django.db.models.fields.CharField', [], {'max_length': '256', 'db_index': 'True'}),\n 'title_iso': ('django.db.models.fields.CharField', [], {'max_length': '256', 'db_index': 'True'}),\n 'twitter_user': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}),\n 'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),\n 'url_journal': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}),\n 'url_online_submission': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}),\n 'use_license': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['journalmanager.UseLicense']\"})\n },\n 'journalmanager.journalmission': {\n 'Meta': {'object_name': 'JournalMission'},\n 'description': ('django.db.models.fields.TextField', [], {}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'journal': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"'missions'\", 'to': \"orm['journalmanager.Journal']\"}),\n 'language': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['journalmanager.Language']\", 'null': 'True'})\n },\n 'journalmanager.journaltimeline': {\n 'Meta': {'object_name': 'JournalTimeline'},\n 'collection': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['journalmanager.Collection']\"}),\n 'created_by': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['auth.User']\"}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'journal': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"'statuses'\", 'to': \"orm['journalmanager.Journal']\"}),\n 'reason': ('django.db.models.fields.TextField', [], {'default': \"''\"}),\n 'since': ('django.db.models.fields.DateTimeField', [], {}),\n 'status': ('django.db.models.fields.CharField', [], {'max_length': '16'})\n },\n 'journalmanager.journaltitle': {\n 'Meta': {'object_name': 'JournalTitle'},\n 'category': ('django.db.models.fields.CharField', [], {'max_length': '128'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'journal': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"'other_titles'\", 'to': \"orm['journalmanager.Journal']\"}),\n 'title': ('django.db.models.fields.CharField', [], {'max_length': '128'})\n },\n 'journalmanager.language': {\n 'Meta': {'ordering': \"['name']\", 'object_name': 'Language'},\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'iso_code': ('django.db.models.fields.CharField', [], {'max_length': '2'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '64'})\n },\n 'journalmanager.membership': {\n 'Meta': {'unique_together': \"(('journal', 'collection'),)\", 'object_name': 'Membership'},\n 'collection': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['journalmanager.Collection']\"}),\n 'created_by': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['auth.User']\"}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'journal': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['journalmanager.Journal']\"}),\n 'reason': ('django.db.models.fields.TextField', [], {'default': \"''\", 'blank': 'True'}),\n 'since': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),\n 'status': ('django.db.models.fields.CharField', [], {'default': \"'inprogress'\", 'max_length': '16'})\n },\n 'journalmanager.pendedform': {\n 'Meta': {'object_name': 'PendedForm'},\n 'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),\n 'form_hash': ('django.db.models.fields.CharField', [], {'max_length': '32'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"'pending_forms'\", 'to': \"orm['auth.User']\"}),\n 'view_name': ('django.db.models.fields.CharField', [], {'max_length': '128'})\n },\n 'journalmanager.pendedvalue': {\n 'Meta': {'object_name': 'PendedValue'},\n 'form': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"'data'\", 'to': \"orm['journalmanager.PendedForm']\"}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),\n 'value': ('django.db.models.fields.TextField', [], {})\n },\n 'journalmanager.pressrelease': {\n 'Meta': {'object_name': 'PressRelease'},\n 'doi': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})\n },\n 'journalmanager.pressreleasearticle': {\n 'Meta': {'object_name': 'PressReleaseArticle'},\n 'article_pid': ('django.db.models.fields.CharField', [], {'max_length': '32', 'db_index': 'True'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'press_release': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"'articles'\", 'to': \"orm['journalmanager.PressRelease']\"})\n },\n 'journalmanager.pressreleasetranslation': {\n 'Meta': {'object_name': 'PressReleaseTranslation'},\n 'content': ('django.db.models.fields.TextField', [], {}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'language': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['journalmanager.Language']\"}),\n 'press_release': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"'translations'\", 'to': \"orm['journalmanager.PressRelease']\"}),\n 'title': ('django.db.models.fields.CharField', [], {'max_length': '128'})\n },\n 'journalmanager.regularpressrelease': {\n 'Meta': {'object_name': 'RegularPressRelease', '_ormbases': ['journalmanager.PressRelease']},\n 'issue': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"'press_releases'\", 'to': \"orm['journalmanager.Issue']\"}),\n 'pressrelease_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': \"orm['journalmanager.PressRelease']\", 'unique': 'True', 'primary_key': 'True'})\n },\n 'journalmanager.section': {\n 'Meta': {'ordering': \"('id',)\", 'object_name': 'Section'},\n 'code': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '21', 'blank': 'True'}),\n 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'is_trashed': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}),\n 'journal': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['journalmanager.Journal']\"}),\n 'legacy_code': ('django.db.models.fields.CharField', [], {'max_length': '16', 'null': 'True', 'blank': 'True'}),\n 'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})\n },\n 'journalmanager.sectiontitle': {\n 'Meta': {'ordering': \"['title']\", 'object_name': 'SectionTitle'},\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'language': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['journalmanager.Language']\"}),\n 'section': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"'titles'\", 'to': \"orm['journalmanager.Section']\"}),\n 'title': ('django.db.models.fields.CharField', [], {'max_length': '256'})\n },\n 'journalmanager.sponsor': {\n 'Meta': {'ordering': \"['name']\", 'object_name': 'Sponsor', '_ormbases': ['journalmanager.Institution']},\n 'collections': ('django.db.models.fields.related.ManyToManyField', [], {'to': \"orm['journalmanager.Collection']\", 'symmetrical': 'False'}),\n 'institution_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': \"orm['journalmanager.Institution']\", 'unique': 'True', 'primary_key': 'True'})\n },\n 'journalmanager.studyarea': {\n 'Meta': {'object_name': 'StudyArea'},\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'study_area': ('django.db.models.fields.CharField', [], {'max_length': '256'})\n },\n 'journalmanager.subjectcategory': {\n 'Meta': {'object_name': 'SubjectCategory'},\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'term': ('django.db.models.fields.CharField', [], {'max_length': '256', 'db_index': 'True'})\n },\n 'journalmanager.translateddata': {\n 'Meta': {'object_name': 'TranslatedData'},\n 'field': ('django.db.models.fields.CharField', [], {'max_length': '32'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'language': ('django.db.models.fields.CharField', [], {'max_length': '32'}),\n 'model': ('django.db.models.fields.CharField', [], {'max_length': '32'}),\n 'translation': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'})\n },\n 'journalmanager.uselicense': {\n 'Meta': {'ordering': \"['license_code']\", 'object_name': 'UseLicense'},\n 'disclaimer': ('django.db.models.fields.TextField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'is_default': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'license_code': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '64'}),\n 'reference_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'})\n },\n 'journalmanager.usercollections': {\n 'Meta': {'unique_together': \"(('user', 'collection'),)\", 'object_name': 'UserCollections'},\n 'collection': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['journalmanager.Collection']\"}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'is_default': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'is_manager': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['auth.User']\"})\n },\n 'journalmanager.userprofile': {\n 'Meta': {'object_name': 'UserProfile'},\n 'email_notifications': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'tz': ('django.db.models.fields.CharField', [], {'default': \"'America/Sao_Paulo'\", 'max_length': '150'}),\n 'user': ('django.db.models.fields.related.OneToOneField', [], {'to': \"orm['auth.User']\", 'unique': 'True'})\n }\n }\n\n complete_apps = ['journalmanager']\n symmetrical = True", "metadata": "root.Migration", "header": "['module', '___EOS___']", "index": 6 }, { "content": " def forwards(self, orm):\n \"Write your forwards methods here.\"\n # Note: Don't use \"from appname.models import ModelName\".\n # Use orm.ModelName to refer to models in this application,\n # and orm['appname.ModelName'] for models in other applications.\n orm.Journal.objects.filter(init_vol=None).update(init_vol='')", "metadata": "root.Migration.forwards", "header": "['class', 'Migration', '(', 'DataMigration', ')', ':', '___EOS___']", "index": 8 }, { "content": " def backwards(self, orm):\n \"Write your backwards methods here.\"\n orm.Journal.objects.filter(init_vol='').update(init_vol=None)", "metadata": "root.Migration.backwards", "header": "['class', 'Migration', '(', 'DataMigration', ')', ':', '___EOS___']", "index": 15 } ]
[ { "span": "from south.utils import datetime_utils as datetime", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 50 }, { "span": "from south.db import db", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 23 }, { "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_", "from_", "south_", "._", "utils_", "import_", "datetime", "\\u", "utils_", "as_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "db_", "import_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "v2_", "import_", "Data", "Migration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Migration_", "(_", "Data", "Migration_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "models_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "auth", ".", "group", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Group", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "80", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "permissi", "ons", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "auth", ".", "Permi", "ssion", "']\"_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "auth", ".", "permissi", "on", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"(", "'", "content", "\\u", "type\\u\\u", "app", "\\u", "label", "',", " ", "'", "content", "\\u", "type\\u\\u", "model", "',", " ", "'", "code", "name", "')\"_", ",_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "('", "content", "\\u", "type", "',", " ", "'", "code", "name", "'),)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Permi", "ssion", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "code", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "\\u", "type", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "contenttype", "s", ".", "Conten", "t", "Type", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "50", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "auth", ".", "user", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "User", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "\\u", "joine", "d", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "datetime", ".", "datetime", ".", "now", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "email", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Ema", "il", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "7", "5", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "first", "\\u", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "30", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "group", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "auth", ".", "Group", "']\"_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "active", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "sta", "ff", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "super", "user", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "last", "\\u", "login", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "datetime", ".", "datetime", ".", "now", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "last", "\\u", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "30", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "password", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "128", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "\\u", "permissi", "ons", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "auth", ".", "Permi", "ssion", "']\"_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "30", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "contenttype", "s", ".", "contenttype", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"(", "'", "name", "',)\"_", ",_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "('", "app", "\\u", "label", "',", " ", "'", "model", "'),)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Conten", "t", "Type", "'_", ",_", "'", "db", "\\u", "table", "'_", ":_", "\"'", "django", "\\u", "content", "\\u", "type", "'\"_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "app", "\\u", "label", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "model", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "journal", "manage", "r", ".", "ahe", "ad", "press", "release", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Ah", "ead", "Press", "Release", "'_", ",_", "'\\u", "ormbase", "s", "'_", ":_", "[_", "'", "journal", "manage", "r", ".", "Press", "Release", "'_", "]_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "journal", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "press", "\\u", "release", "s", "'\"_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Journ", "al", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "press", "release", "\\u", "ptr", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "One", "To", "One", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Press", "Release", "']\"_", ",_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "journal", "manage", "r", ".", "article", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Artic", "le", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "aid", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "32", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "article", "\\u", "type", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "32", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "article", "s", "\\u", "linkage", "\\u", "is", "\\u", "pend", "ing", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "created", "\\u", "at", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "datetime", ".", "datetime", ".", "now", "'_", ",_", "'", "auto", "\\u", "now", "\\u", "add", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "doi", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"", "u", "''", "\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "204", "8", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "domain", "\\u", "key", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Sl", "ug", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "204", "8", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "es", "\\u", "is", "\\u", "dir", "ty", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "es", "\\u", "update", "d\\u", "at", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "ao", "p", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "visi", "ble", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "issn", "\\u", "epub", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "9", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "issn", "\\u", "pp", "ub", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "9", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "issue", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "article", "s", "'\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Issue", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "journal", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "article", "s", "'\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Journ", "al", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "journal", "\\u", "title", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "512", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "relate", "d\\u", "article", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Artic", "le", "']\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "through", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Artic", "les", "Link", "age", "']\"_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "update", "d\\u", "at", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "datetime", ".", "datetime", ".", "now", "'_", ",_", "'", "auto", "\\u", "now", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "xml", "'_", ":_", "(_", "'", "scie", "lom", "anager", ".", "custom", "\\u", "fields", ".", "XML", "SP", "SF", "iel", "d", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "xml", "\\u", "version", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "9", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "journal", "manage", "r", ".", "article", "sli", "nk", "age", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Artic", "les", "Link", "age", "'_", "}_", ",_", "\\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_", "'", "link", "\\u", "to", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "referrer", "s", "'\"_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Artic", "le", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "link", "\\u", "type", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "32", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "referrer", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "link", "s", "\\u", "to", "'\"_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Artic", "le", "']\"_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "journal", "manage", "r", ".", "collection", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"[", "'", "name", "']\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Collecti", "on", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "acronym", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "16", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "address", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "address", "\\u", "complement", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "128", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "address", "\\u", "number", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "8", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "city", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "32", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "collection", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "user", "\\u", "collection", "'\"_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "auth", ".", "User", "']\"_", ",_", "'", "through", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "User", "Collections", "']\"_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "countr", "y", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "32", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "email", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Ema", "il", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "7", "5", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fax", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "16", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "logo", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "files", ".", "Image", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "128", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "\\u", "slug", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Sl", "ug", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "50", "'_", ",_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "phone", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "16", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "state", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "32", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "URL", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "200", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "zip", "\\u", "code", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "16", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "journal", "manage", "r", ".", "institution", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"[", "'", "name", "']\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Institut", "ion", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "acronym", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "16", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "address", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "address", "\\u", "complement", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "128", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "address", "\\u", "number", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "8", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cel", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "16", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "city", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "32", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "complement", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"''\"_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "countr", "y", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "32", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "created", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "\\u", "add", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "email", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Ema", "il", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "7", "5", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fax", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "16", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "trash", "ed", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "256", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "phone", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "16", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "state", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "32", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "update", "d", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "zip", "\\u", "code", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "16", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "journal", "manage", "r", ".", "issue", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"(", "'", "created", "',", " ", "'", "id", "')\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Issue", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cover", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "files", ".", "Image", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "created", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "\\u", "add", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ctrl", "\\u", "vocab", "ular", "y", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "64", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "editor", "ial", "\\u", "standard", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "64", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "marked", "\\u", "up", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "trash", "ed", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "journal", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Journ", "al", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "label", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "64", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "number", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "16", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "order", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "publicat", "ion", "\\u", "end", "\\u", "month", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "publicat", "ion", "\\u", "start", "\\u", "month", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "publicat", "ion", "\\u", "year", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "section", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Sect", "ion", "']\"_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "spe", "\\u", "text", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "15", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "suppl", "\\u", "text", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "15", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "total", "\\u", "document", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "0", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "type", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"'", "regular", "'\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "15", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "update", "d", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "use", "\\u", "license", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Us", "e", "License", "']\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "volume", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "16", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "journal", "manage", "r", ".", "issue", "title", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Issue", "Tit", "le", "'_", "}_", ",_", "\\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_", "'", "issue", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Issue", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "language", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Lang", "ua", "ge", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "title", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "256", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "journal", "manage", "r", ".", "journal", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"(", "'", "title", "',", " ", "'", "id", "')\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Journ", "al", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "abstract", "\\u", "keyw", "ord", "\\u", "language", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "abstract", "\\u", "keyw", "ord", "\\u", "language", "s", "'\"_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Lang", "ua", "ge", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "acronym", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "16", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cc", "n", "\\u", "code", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"''\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "64", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "collection", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Collecti", "on", "']\"_", ",_", "'", "through", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Membership", "']\"_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "copyr", "ight", "er", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "254", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cover", "'_", ":_", "(_", "'", "scie", "lom", "anager", ".", "custom", "\\u", "fields", ".", "Conten", "t", "Type", "Restrict", "ed", "File", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "created", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "\\u", "add", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "creat", "or", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "enj", "oy", "\\u", "creat", "or", "'\"_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "auth", ".", "User", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ctrl", "\\u", "vocab", "ular", "y", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "64", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "current", "\\u", "ahe", "ad", "\\u", "document", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "0", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "3", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "editor", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "editor", "\\u", "journal", "'\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "auth", ".", "User", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "editor", "\\u", "address", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "512", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "editor", "\\u", "address", "\\u", "city", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "256", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "editor", "\\u", "address", "\\u", "countr", "y", "'_", ":_", "(_", "'", "scie", "lo", "\\u", "extensi", "ons", ".", "modelf", "ields", ".", "Count", "ry", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "2", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "editor", "\\u", "address", "\\u", "state", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "128", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "editor", "\\u", "address", "\\u", "zip", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "64", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "editor", "\\u", "email", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Ema", "il", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "7", "5", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "editor", "\\u", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "512", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "editor", "\\u", "phone", "1", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "32", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "editor", "\\u", "phone", "2", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "32", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "editor", "ial", "\\u", "standard", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "64", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ele", "tron", "ic", "\\u", "issn", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "9", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "final", "\\u", "num", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "16", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "final", "\\u", "vol", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "16", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "final", "\\u", "year", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "4", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "freque", "nc", "y", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "16", "'_", "}_", ")_", ",_", "\\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_", "'", "index", "\\u", "covera", "ge", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "init", "\\u", "num", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "16", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "init", "\\u", "vol", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "16", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "init", "\\u", "year", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "4", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "indexe", "d\\u", "ae", "hc", "i", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "indexe", "d\\u", "scie", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "indexe", "d\\u", "ssc", "i", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "trash", "ed", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "language", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Lang", "ua", "ge", "']\"_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "logo", "'_", ":_", "(_", "'", "scie", "lom", "anager", ".", "custom", "\\u", "fields", ".", "Conten", "t", "Type", "Restrict", "ed", "File", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "med", "line", "\\u", "code", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "64", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "med", "line", "\\u", "title", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "256", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "note", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "254", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "other", "\\u", "previ", "ous", "\\u", "title", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "previ", "ous", "\\u", "ahe", "ad", "\\u", "document", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "0", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "3", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "previ", "ous", "\\u", "title", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "prev", "\\u", "title", "'\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Journ", "al", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "print", "\\u", "issn", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "9", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pub", "\\u", "level", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "64", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "publicat", "ion", "\\u", "city", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "64", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "publi", "sher", "\\u", "countr", "y", "'_", ":_", "(_", "'", "scie", "lo", "\\u", "extensi", "ons", ".", "modelf", "ields", ".", "Count", "ry", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "2", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "publi", "sher", "\\u", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "256", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "publi", "sher", "\\u", "state", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "64", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "scie", "lo", "\\u", "issn", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "16", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "secs", "\\u", "code", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "64", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "short", "\\u", "title", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "256", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sponsor", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "journal", "\\u", "sponsor", "'\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Spo", "nsor", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "stud", "y", "\\u", "area", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "journal", "s", "\\u", "migrati", "on", "\\u", "tmp", "'\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Stud", "y", "Area", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "subject", "\\u", "categor", "ies", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "journal", "s", "'\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Sub", "ject", "Cate", "gory", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "subject", "\\u", "descrip", "tors", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "1024", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "title", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "256", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "title", "\\u", "iso", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "256", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "twit", "ter", "\\u", "user", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "128", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "update", "d", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "\\u", "journal", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "128", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "\\u", "onli", "ne", "\\u", "subm", "ission", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "128", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "use", "\\u", "license", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Us", "e", "License", "']\"_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "journal", "manage", "r", ".", "journal", "missio", "n", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Journ", "al", "Mission", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "description", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\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_", "'", "journal", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "missio", "ns", "'\"_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Journ", "al", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "language", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Lang", "ua", "ge", "']\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "journal", "manage", "r", ".", "journal", "timeline", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Journ", "al", "Time", "line", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "collection", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Collecti", "on", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "created", "\\u", "by", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "auth", ".", "User", "']\"_", "}_", ")_", ",_", "\\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_", "'", "journal", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "status", "es", "'\"_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Journ", "al", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reason", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"''\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sinc", "e", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "16", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "journal", "manage", "r", ".", "journal", "title", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Journ", "al", "Tit", "le", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "category", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "128", "'_", "}_", ")_", ",_", "\\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_", "'", "journal", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "other", "\\u", "titles", "'\"_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Journ", "al", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "title", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "128", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "journal", "manage", "r", ".", "language", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"[", "'", "name", "']\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Lang", "ua", "ge", "'_", "}_", ",_", "\\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_", "'", "iso", "\\u", "code", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "2", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "64", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "journal", "manage", "r", ".", "member", "ship", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "('", "journal", "',", " ", "'", "collection", "'),)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Membership", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "collection", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Collecti", "on", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "created", "\\u", "by", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "auth", ".", "User", "']\"_", "}_", ")_", ",_", "\\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_", "'", "journal", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Journ", "al", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reason", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"''\"_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sinc", "e", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"'", "inpr", "ogr", "ess", "'\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "16", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "journal", "manage", "r", ".", "pend", "edf", "orm", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Pend", "ed", "Form", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "created", "\\u", "at", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "\\u", "hash", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "32", "'_", "}_", ")_", ",_", "\\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_", "'", "user", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "pend", "ing", "\\u", "forms", "'\"_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "auth", ".", "User", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "view", "\\u", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "128", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "journal", "manage", "r", ".", "pend", "ed", "value", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Pend", "ed", "Value", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "data", "'\"_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Pend", "ed", "Form", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "value", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "journal", "manage", "r", ".", "press", "release", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Press", "Release", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "doi", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "128", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "journal", "manage", "r", ".", "press", "release", "article", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Press", "Release", "Artic", "le", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "article", "\\u", "pid", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "32", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "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_", "'", "press", "\\u", "release", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "article", "s", "'\"_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Press", "Release", "']\"_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "journal", "manage", "r", ".", "press", "release", "translatio", "n", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Press", "Release", "Translat", "ion", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\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_", "'", "language", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Lang", "ua", "ge", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "press", "\\u", "release", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "translatio", "ns", "'\"_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Press", "Release", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "title", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "128", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "journal", "manage", "r", ".", "regular", "press", "release", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Regula", "r", "Press", "Release", "'_", ",_", "'\\u", "ormbase", "s", "'_", ":_", "[_", "'", "journal", "manage", "r", ".", "Press", "Release", "'_", "]_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "issue", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "press", "\\u", "release", "s", "'\"_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Issue", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "press", "release", "\\u", "ptr", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "One", "To", "One", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Press", "Release", "']\"_", ",_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "journal", "manage", "r", ".", "section", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"(", "'", "id", "',)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Sect", "ion", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "code", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "21", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "created", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "\\u", "add", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "trash", "ed", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "journal", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Journ", "al", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "lega", "cy", "\\u", "code", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "16", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "update", "d", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "journal", "manage", "r", ".", "section", "title", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"[", "'", "title", "']\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Sect", "ion", "Tit", "le", "'_", "}_", ",_", "\\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_", "'", "language", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Lang", "ua", "ge", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "section", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "titles", "'\"_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Sect", "ion", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "title", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "256", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "journal", "manage", "r", ".", "sponsor", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"[", "'", "name", "']\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Spo", "nsor", "'_", ",_", "'\\u", "ormbase", "s", "'_", ":_", "[_", "'", "journal", "manage", "r", ".", "Institut", "ion", "'_", "]_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "collection", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Collecti", "on", "']\"_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "institution", "\\u", "ptr", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "One", "To", "One", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Institut", "ion", "']\"_", ",_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "journal", "manage", "r", ".", "stud", "yar", "ea", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Stud", "y", "Area", "'_", "}_", ",_", "\\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_", "'", "stud", "y", "\\u", "area", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "256", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "journal", "manage", "r", ".", "subject", "category", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Sub", "ject", "Cate", "gory", "'_", "}_", ",_", "\\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_", "'", "term", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "256", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "journal", "manage", "r", ".", "translat", "edd", "ata", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Translate", "d", "Data", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "field", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "32", "'_", "}_", ")_", ",_", "\\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_", "'", "language", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "32", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "model", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "32", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "translatio", "n", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "512", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "journal", "manage", "r", ".", "usel", "ice", "nse", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"[", "'", "license", "\\u", "code", "']\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Us", "e", "License", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "discl", "aime", "r", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "512", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "default", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "license", "\\u", "code", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "64", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reference", "\\u", "url", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "URL", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "200", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "journal", "manage", "r", ".", "userco", "lle", "ctions", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "('", "user", "',", " ", "'", "collection", "'),)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "User", "Collections", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "collection", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Collecti", "on", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "default", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "manage", "r", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "auth", ".", "User", "']\"_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "journal", "manage", "r", ".", "userprofile", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "User", "Profil", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "email", "\\u", "notification", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "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_", "'", "tz", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"'", "Ame", "rica", "/", "Sa", "o", "\\u", "Paul", "o", "'\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "150", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "One", "To", "One", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "auth", ".", "User", "']\"_", ",_", "'", "unique", "'_", ":_", "'", "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_", "=_", "[_", "'", "journal", "manage", "r", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "symmetric", "al_", "=_", "True_", "[SEP]_", "class_", "Migration_", "(_", "Data", "Migration_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "forwards_", "(_", "self_", ",_", "orm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Write", " ", "your", " ", "forward", "s", " ", "method", "s", " ", "here", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Not", "e", ":", " ", "Don", "'", "t", " ", "use", " ", "\"", "from", " ", "app", "name", ".", "model", "s", " ", "import", " ", "Model", "Name", "\".", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Us", "e", " ", "orm", ".", "Model", "Name", " ", "to", " ", "refer", " ", "to", " ", "model", "s", " ", "in", " ", "this", " ", "applica", "tion", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "orm", "['", "app", "name", ".", "Model", "Name", "']", " ", "for", " ", "model", "s", " ", "in", " ", "other", " ", "applica", "tion", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "orm_", "._", "Journ", "al_", "._", "objects_", "._", "filter_", "(_", "init", "\\u", "vol_", "=_", "None_", ")_", "._", "update_", "(_", "init", "\\u", "vol_", "=_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Migration_", "(_", "Data", "Migration_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "backwards_", "(_", "self_", ",_", "orm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Write", " ", "your", " ", "back", "ward", "s", " ", "method", "s", " ", "here", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "orm_", "._", "Journ", "al_", "._", "objects_", "._", "filter_", "(_", "init", "\\u", "vol_", "=_", "''_", ")_", "._", "update_", "(_", "init", "\\u", "vol_", "=_", "None_", ")_", "\\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, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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/test_apps/properties/models.py
[ { "content": "\"\"\"\nModule `lino_xl.lib.properties`\n-------------------------------\n\nImagine that we are doing a study about alimentary habits. We observe a \ndefined series of properties on the people who participate in our study.\nHere are the properties that we are going to observe::\n\n\n >>> weight = properties.INT.create_property(name='weight')\n >>> weight.save()\n \n >>> married = properties.BOOL.create_property(name='married')\n >>> married.save()\n \n >>> favdish = properties.CHAR.create_property(name='favdish',label='favorite dish')\n >>> favdish.save()\n >>> favdish.create_value(\"Cookies\").save()\n >>> v = favdish.create_value(\"Fish\").save()\n >>> favdish.create_value(\"Meat\").save()\n >>> favdish.create_value(\"Vegetables\").save()\n\n \nNow we have setup the properties. Let's have a look at this metadata::\n \n >>> print favdish.choices_list()\n [u'Cookies', u'Fish', u'Meat', u'Vegetables']\n >>> qs = properties.Property.objects.all()\n >>> [\"%s (%s)\" % (p.name,','.join(map(unicode,p.choices_list()))) for p in qs]\n [u'weight ()', u'married (True,False)', u'favdish (Cookies,Fish,Meat,Vegetables)']\n \nPropValuesByOwner is a report that cannot be rendered into a normal grid because the 'value' column has variable data type, but it's render_to_dict() method is used to fill an `Ext.grid.PropertyGrid`:\n\n >>> properties.PropValuesByOwner().request(master=Person).render_to_dict()\n {'count': 3, 'rows': [{'name': u'favdish', 'value': ''}, {'name': u'married', 'value': None}, {'name': u'weight', 'value': None}], 'title': u'Properties for persons'}\n \n \nHere are the people we are going to analyze::\n\n >>> chris = Person(name='Chris')\n >>> chris.save()\n >>> fred = Person(name='Fred')\n >>> fred.save()\n >>> vera = Person(name='Vera')\n >>> vera.save()\n >>> mary = Person(name='Mary')\n >>> mary.save()\n \nNow we are ready to fill in some real data. Chris, Fred and Vera \nanswered together to each question. First we asked them \"What's \nyour weight?\", and they answered:\n \n >>> weight.set_value_for(chris,70)\n >>> weight.set_value_for(fred,110)\n >>> weight.set_value_for(vera,60)\n \nWhen asked whether they were married, they answered:\n \n >>> married.set_value_for(chris,True)\n >>> married.set_value_for(fred,False)\n >>> married.set_value_for(vera,True)\n\nAnd about their favourite dish they answered:\n \n >>> favdish.set_value_for(chris,'Cookies')\n >>> favdish.set_value_for(fred,'Fish')\n >>> favdish.set_value_for(vera,'Vegetables')\n\nMary came later. She answered all questions at once, which we can enter \nin one line of code:\n \n >>> properties.set_value_for(mary,married=True,favdish='Meat')\n \nNote that Mary didn't know her weight.\n\nTo see the property values of a person, we can use a manual query...\n\n >>> qs = properties.PropValue.objects.filter(owner_id=fred.pk).order_by('prop__name')\n >>> [v.by_owner() for v in qs]\n [u'favdish: Fish', u'married: False', u'weight: 110']\n \n... or use the `PropValuesByOwner` report:\n\n >>> properties.PropValuesByOwner().request(master_instance=fred).render_to_dict()\n {'count': 3, 'rows': [{'name': u'favdish', 'value': u'Fish'}, {'name': u'married', 'value': False}, {'name': u'weight', 'value': 110}], 'title': u'Properties for Fred'}\n \nNote how properties.PropValuesByOwner also returns 3 rows for Mary although we don't know her weight:\n \n >>> properties.PropValuesByOwner().request(master_instance=mary).render_to_dict()\n {'count': 3, 'rows': [{'name': u'favdish', 'value': u'Meat'}, {'name': u'married', 'value': True}, {'name': u'weight', 'value': None}], 'title': u'Properties for Mary'}\n \nQuery by property:\n\n >>> qs = properties.PropValue.objects.filter(prop=weight) \n >>> [v.by_property() for v in qs]\n [u'Chris: 70', u'Fred: 110', u'Vera: 60']\n \n >>> qs = weight.values_query().order_by('value')\n >>> [v.by_property() for v in qs]\n [u'Vera: 60', u'Chris: 70', u'Fred: 110']\n \n \n`Report.as_text()`, is currently broken:\n\n >>> #properties.PropValuesByOwner().as_text(fred)\n\n\n\"\"\"\n\n\nfrom django.db import models\nfrom django.contrib.contenttypes.models import ContentType\nfrom django.contrib.contenttypes import generic\nfrom lino_xl.lib.properties import models as properties\nfrom django.utils.encoding import python_2_unicode_compatible\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@python_2_unicode_compatible\nclass Person(models.Model):\n name = models.CharField(max_length=20)\n properties = generic.GenericRelation(properties.Property)\n", "metadata": "root.Person", "header": "['module', '___EOS___']", "index": 117 }, { "content": " def __str__(self):\n return self.name", "metadata": "root.Person.__str__", "header": "['class', 'Person', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 122 } ]
[ { "span": "from django.contrib.contenttypes.models import ContentType", "start_line": 111, "start_column": 0, "end_line": 111, "end_column": 58 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Modul", "e", " ", "`", "lino", "\\u", "xl", ".", "lib", ".", "proper", "ties", "`", "\\", "10", ";", "--------------", "--------------", "---", "\\", "10", ";", "\\", "10", ";", "Imagin", "e", " ", "tha", "t", " ", "we", " ", "are", " ", "doi", "ng", " ", "a", " ", "stud", "y", " ", "abo", "ut", " ", "ali", "menta", "ry", " ", "habit", "s", ".", " ", "We", " ", "observe", " ", "a", " ", "\\", "10", ";", "defin", "ed", " ", "series", " ", "of", " ", "proper", "ties", " ", "on", " ", "the", " ", "people", " ", "who", " ", "participa", "te", " ", "in", " ", "our", " ", "stud", "y", ".", "\\", "10", ";", "Her", "e", " ", "are", " ", "the", " ", "proper", "ties", " ", "tha", "t", " ", "we", " ", "are", " ", "goi", "ng", " ", "to", " ", "observe", "::", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", ">>>", " ", "weight", " ", "=", " ", "proper", "ties", ".", "INT", ".", "create", "\\u", "property", "(", "name", "='", "weight", "')", "\\", "10", ";", " ", " ", ">>>", " ", "weight", ".", "save", "()", "\\", "10", ";", " ", " ", "\\", "10", ";", " ", " ", ">>>", " ", "marr", "ied", " ", "=", " ", "proper", "ties", ".", "BOO", "L", ".", "create", "\\u", "property", "(", "name", "='", "marr", "ied", "')", "\\", "10", ";", " ", " ", ">>>", " ", "marr", "ied", ".", "save", "()", "\\", "10", ";", " ", " ", "\\", "10", ";", " ", " ", ">>>", " ", "fav", "dis", "h", " ", "=", " ", "proper", "ties", ".", "CHAR", ".", "create", "\\u", "property", "(", "name", "='", "fav", "dis", "h", "',", "label", "='", "favorite", " ", "dis", "h", "')", "\\", "10", ";", " ", " ", ">>>", " ", "fav", "dis", "h", ".", "save", "()", "\\", "10", ";", " ", " ", ">>>", " ", "fav", "dis", "h", ".", "create", "\\u", "value", "(\"", "Cooki", "es", "\")", ".", "save", "()", "\\", "10", ";", " ", " ", ">>>", " ", "v", " ", "=", " ", "fav", "dis", "h", ".", "create", "\\u", "value", "(\"", "Fish", "\")", ".", "save", "()", "\\", "10", ";", " ", " ", ">>>", " ", "fav", "dis", "h", ".", "create", "\\u", "value", "(\"", "Mea", "t", "\")", ".", "save", "()", "\\", "10", ";", " ", " ", ">>>", " ", "fav", "dis", "h", ".", "create", "\\u", "value", "(\"", "Ve", "geta", "bles", "\")", ".", "save", "()", "\\", "10", ";", "\\", "10", ";", " ", " ", "\\", "10", ";", "No", "w", " ", "we", " ", "have", " ", "setup", " ", "the", " ", "proper", "ties", ".", " ", "Let", "'", "s", " ", "have", " ", "a", " ", "look", " ", "at", " ", "this", " ", "metadata", "::", "\\", "10", ";", " ", " ", "\\", "10", ";", " ", " ", ">>>", " ", "print", " ", "fav", "dis", "h", ".", "choice", "s", "\\u", "list", "()", "\\", "10", ";", " ", " ", "[", "u", "'", "Cooki", "es", "',", " ", "u", "'", "Fish", "',", " ", "u", "'", "Mea", "t", "',", " ", "u", "'", "Ve", "geta", "bles", "']", "\\", "10", ";", " ", " ", ">>>", " ", "qs", " ", "=", " ", "proper", "ties", ".", "Proper", "ty", ".", "object", "s", ".", "all", "()", "\\", "10", ";", " ", " ", ">>>", " ", "[\"", "%", "s", " ", "(%", "s", ")\"", " ", "%", " ", "(", "p", ".", "name", ",'", ",'", ".", "join", "(", "map", "(", "unicode", ",", "p", ".", "choice", "s", "\\u", "list", "())", "))", " ", "for", " ", "p", " ", "in", " ", "qs", "]", "\\", "10", ";", " ", " ", "[", "u", "'", "weight", " ", "()'", ",", " ", "u", "'", "marr", "ied", " ", "(", "Tru", "e", ",", "Fal", "se", ")'", ",", " ", "u", "'", "fav", "dis", "h", " ", "(", "Cooki", "es", ",", "Fish", ",", "Mea", "t", ",", "Ve", "geta", "bles", ")'", "]", "\\", "10", ";", " ", " ", "\\", "10", ";", "Prop", "Value", "s", "By", "Owne", "r", " ", "is", " ", "a", " ", "report", " ", "tha", "t", " ", "cann", "ot", " ", "be", " ", "render", "ed", " ", "int", "o", " ", "a", " ", "normal", " ", "grid", " ", "bec", "aus", "e", " ", "the", " ", "'", "value", "'", " ", "column", " ", "has", " ", "variab", "le", " ", "data", " ", "type", ",", " ", "but", " ", "it", "'", "s", " ", "render", "\\u", "to", "\\u", "dict", "()", " ", "method", " ", "is", " ", "used", " ", "to", " ", "fill", " ", "an", " ", "`", "Ext", ".", "grid", ".", "Proper", "ty", "Grid", "`", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", ">>>", " ", "proper", "ties", ".", "Prop", "Value", "s", "By", "Owne", "r", "()", ".", "request", "(", "master", "=", "Person", ").", "render", "\\u", "to", "\\u", "dict", "()", "\\", "10", ";", " ", " ", "{", "'", "count", "':", " ", "3", ",", " ", "'", "rows", "':", " ", "[{", "'", "name", "':", " ", "u", "'", "fav", "dis", "h", "',", " ", "'", "value", "':", " ", "''", "},", " ", "{", "'", "name", "':", " ", "u", "'", "marr", "ied", "',", " ", "'", "value", "':", " ", "Non", "e", "},", " ", "{", "'", "name", "':", " ", "u", "'", "weight", "',", " ", "'", "value", "':", " ", "Non", "e", "}]", ",", " ", "'", "title", "':", " ", "u", "'", "Proper", "ties", " ", "for", " ", "person", "s", "'}", "\\", "10", ";", " ", " ", "\\", "10", ";", " ", "\\", "10", ";", "Her", "e", " ", "are", " ", "the", " ", "people", " ", "we", " ", "are", " ", "goi", "ng", " ", "to", " ", "analyze", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", ">>>", " ", "chris", " ", "=", " ", "Person", "(", "name", "='", "Chr", "is", "')", "\\", "10", ";", " ", " ", ">>>", " ", "chris", ".", "save", "()", "\\", "10", ";", " ", " ", ">>>", " ", "fre", "d", " ", "=", " ", "Person", "(", "name", "='", "Fre", "d", "')", "\\", "10", ";", " ", " ", ">>>", " ", "fre", "d", ".", "save", "()", "\\", "10", ";", " ", " ", ">>>", " ", "vera", " ", "=", " ", "Person", "(", "name", "='", "Ver", "a", "')", "\\", "10", ";", " ", " ", ">>>", " ", "vera", ".", "save", "()", "\\", "10", ";", " ", " ", ">>>", " ", "mar", "y", " ", "=", " ", "Person", "(", "name", "='", "Mar", "y", "')", "\\", "10", ";", " ", " ", ">>>", " ", "mar", "y", ".", "save", "()", "\\", "10", ";", " ", " ", "\\", "10", ";", "No", "w", " ", "we", " ", "are", " ", "read", "y", " ", "to", " ", "fill", " ", "in", " ", "some", " ", "real", " ", "data", ".", " ", "Chr", "is", ",", " ", "Fre", "d", " ", "and", " ", "Ver", "a", " ", "\\", "10", ";", "answer", "ed", " ", "tog", "ether", " ", "to", " ", "each", " ", "question", ".", " ", "Fi", "rst", " ", "we", " ", "ask", "ed", " ", "them", " ", "\"", "What", "'", "s", " ", "\\", "10", ";", "your", " ", "weight", "?\"", ",", " ", "and", " ", "the", "y", " ", "answer", "ed", ":", "\\", "10", ";", " ", " ", "\\", "10", ";", " ", " ", ">>>", " ", "weight", ".", "set\\u", "value", "\\u", "for", "(", "chris", ",", "7", "0", ")", "\\", "10", ";", " ", " ", ">>>", " ", "weight", ".", "set\\u", "value", "\\u", "for", "(", "fre", "d", ",", "110", ")", "\\", "10", ";", " ", " ", ">>>", " ", "weight", ".", "set\\u", "value", "\\u", "for", "(", "vera", ",", "60", ")", "\\", "10", ";", " ", " ", "\\", "10", ";", "Whe", "n", " ", "ask", "ed", " ", "whe", "ther", " ", "the", "y", " ", "wer", "e", " ", "marr", "ied", ",", " ", "the", "y", " ", "answer", "ed", ":", "\\", "10", ";", " ", " ", "\\", "10", ";", " ", " ", ">>>", " ", "marr", "ied", ".", "set\\u", "value", "\\u", "for", "(", "chris", ",", "Tru", "e", ")", "\\", "10", ";", " ", " ", ">>>", " ", "marr", "ied", ".", "set\\u", "value", "\\u", "for", "(", "fre", "d", ",", "Fal", "se", ")", "\\", "10", ";", " ", " ", ">>>", " ", "marr", "ied", ".", "set\\u", "value", "\\u", "for", "(", "vera", ",", "Tru", "e", ")", "\\", "10", ";", "\\", "10", ";", "And", " ", "abo", "ut", " ", "thei", "r", " ", "favourite", " ", "dis", "h", " ", "the", "y", " ", "answer", "ed", ":", "\\", "10", ";", " ", " ", "\\", "10", ";", " ", " ", ">>>", " ", "fav", "dis", "h", ".", "set\\u", "value", "\\u", "for", "(", "chris", ",'", "Cooki", "es", "')", "\\", "10", ";", " ", " ", ">>>", " ", "fav", "dis", "h", ".", "set\\u", "value", "\\u", "for", "(", "fre", "d", ",'", "Fish", "')", "\\", "10", ";", " ", " ", ">>>", " ", "fav", "dis", "h", ".", "set\\u", "value", "\\u", "for", "(", "vera", ",'", "Ve", "geta", "bles", "')", "\\", "10", ";", "\\", "10", ";", "Mar", "y", " ", "came", " ", "late", "r", ".", " ", "She", " ", "answer", "ed", " ", "all", " ", "question", "s", " ", "at", " ", "onc", "e", ",", " ", "whi", "ch", " ", "we", " ", "can", " ", "enter", " ", "\\", "10", ";", "in", " ", "one", " ", "line", " ", "of", " ", "code", ":", "\\", "10", ";", " ", " ", "\\", "10", ";", " ", " ", ">>>", " ", "proper", "ties", ".", "set\\u", "value", "\\u", "for", "(", "mar", "y", ",", "marr", "ied", "=", "Tru", "e", ",", "fav", "dis", "h", "='", "Mea", "t", "')", "\\", "10", ";", " ", " ", "\\", "10", ";", "Not", "e", " ", "tha", "t", " ", "Mar", "y", " ", "did", "n", "'", "t", " ", "know", " ", "her", " ", "weight", ".", "\\", "10", ";", "\\", "10", ";", "To", " ", "see", " ", "the", " ", "property", " ", "values", " ", "of", " ", "a", " ", "person", ",", " ", "we", " ", "can", " ", "use", " ", "a", " ", "manu", "al", " ", "query", "...", "\\", "10", ";", "\\", "10", ";", " ", " ", ">>>", " ", "qs", " ", "=", " ", "proper", "ties", ".", "Prop", "Value", ".", "object", "s", ".", "filter", "(", "owner", "\\u", "id", "=", "fre", "d", ".", "pk", ").", "order", "\\u", "by", "('", "prop", "\\u\\u", "name", "')", "\\", "10", ";", " ", " ", ">>>", " ", "[", "v", ".", "by", "\\u", "owner", "()", " ", "for", " ", "v", " ", "in", " ", "qs", "]", "\\", "10", ";", " ", " ", "[", "u", "'", "fav", "dis", "h", ":", " ", "Fish", "',", " ", "u", "'", "marr", "ied", ":", " ", "Fal", "se", "',", " ", "u", "'", "weight", ":", " ", "110", "']", "\\", "10", ";", " ", " ", "\\", "10", ";", "...", " ", "or", " ", "use", " ", "the", " ", "`", "Prop", "Value", "s", "By", "Owne", "r", "`", " ", "report", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", ">>>", " ", "proper", "ties", ".", "Prop", "Value", "s", "By", "Owne", "r", "()", ".", "request", "(", "master", "\\u", "instance", "=", "fre", "d", ").", "render", "\\u", "to", "\\u", "dict", "()", "\\", "10", ";", " ", " ", "{", "'", "count", "':", " ", "3", ",", " ", "'", "rows", "':", " ", "[{", "'", "name", "':", " ", "u", "'", "fav", "dis", "h", "',", " ", "'", "value", "':", " ", "u", "'", "Fish", "'}", ",", " ", "{", "'", "name", "':", " ", "u", "'", "marr", "ied", "',", " ", "'", "value", "':", " ", "Fal", "se", "},", " ", "{", "'", "name", "':", " ", "u", "'", "weight", "',", " ", "'", "value", "':", " ", "110", "}]", ",", " ", "'", "title", "':", " ", "u", "'", "Proper", "ties", " ", "for", " ", "Fre", "d", "'}", "\\", "10", ";", " ", " ", "\\", "10", ";", "Not", "e", " ", "how", " ", "proper", "ties", ".", "Prop", "Value", "s", "By", "Owne", "r", " ", "als", "o", " ", "return", "s", " ", "3", " ", "rows", " ", "for", " ", "Mar", "y", " ", "alth", "ou", "gh", " ", "we", " ", "don", "'", "t", " ", "know", " ", "her", " ", "weight", ":", "\\", "10", ";", " ", " ", "\\", "10", ";", " ", " ", ">>>", " ", "proper", "ties", ".", "Prop", "Value", "s", "By", "Owne", "r", "()", ".", "request", "(", "master", "\\u", "instance", "=", "mar", "y", ").", "render", "\\u", "to", "\\u", "dict", "()", "\\", "10", ";", " ", " ", "{", "'", "count", "':", " ", "3", ",", " ", "'", "rows", "':", " ", "[{", "'", "name", "':", " ", "u", "'", "fav", "dis", "h", "',", " ", "'", "value", "':", " ", "u", "'", "Mea", "t", "'}", ",", " ", "{", "'", "name", "':", " ", "u", "'", "marr", "ied", "',", " ", "'", "value", "':", " ", "Tru", "e", "},", " ", "{", "'", "name", "':", " ", "u", "'", "weight", "',", " ", "'", "value", "':", " ", "Non", "e", "}]", ",", " ", "'", "title", "':", " ", "u", "'", "Proper", "ties", " ", "for", " ", "Mar", "y", "'}", "\\", "10", ";", " ", " ", "\\", "10", ";", "Query", " ", "by", " ", "property", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", ">>>", " ", "qs", " ", "=", " ", "proper", "ties", ".", "Prop", "Value", ".", "object", "s", ".", "filter", "(", "prop", "=", "weight", ")", " ", "\\", "10", ";", " ", " ", ">>>", " ", "[", "v", ".", "by", "\\u", "property", "()", " ", "for", " ", "v", " ", "in", " ", "qs", "]", "\\", "10", ";", " ", " ", "[", "u", "'", "Chr", "is", ":", " ", "7", "0", "',", " ", "u", "'", "Fre", "d", ":", " ", "110", "',", " ", "u", "'", "Ver", "a", ":", " ", "60", "']", "\\", "10", ";", " ", " ", "\\", "10", ";", " ", " ", ">>>", " ", "qs", " ", "=", " ", "weight", ".", "values", "\\u", "query", "()", ".", "order", "\\u", "by", "('", "value", "')", "\\", "10", ";", " ", " ", ">>>", " ", "[", "v", ".", "by", "\\u", "property", "()", " ", "for", " ", "v", " ", "in", " ", "qs", "]", "\\", "10", ";", " ", " ", "[", "u", "'", "Ver", "a", ":", " ", "60", "',", " ", "u", "'", "Chr", "is", ":", " ", "7", "0", "',", " ", "u", "'", "Fre", "d", ":", " ", "110", "']", "\\", "10", ";", " ", " ", "\\", "10", ";", " ", " ", "\\", "10", ";", "`", "Report", ".", "as", "\\u", "text", "()`", ",", " ", "is", " ", "currentl", "y", " ", "broken", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", ">>>", " ", "#", "proper", "ties", ".", "Prop", "Value", "s", "By", "Owne", "r", "()", ".", "as", "\\u", "text", "(", "fre", "d", ")", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "contenttype", "s_", "._", "models_", "import_", "Conten", "t", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "contenttype", "s_", "import_", "generic_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "lino", "\\u", "xl_", "._", "lib_", "._", "properties_", "import_", "models_", "as_", "properties_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "encoding_", "import_", "python", "\\u", "2", "\\u", "unicode", "\\u", "compatible_", "\\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_", "@_", "python", "\\u", "2", "\\u", "unicode", "\\u", "compatible_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Person_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "20_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "properties_", "=_", "generic_", "._", "Gene", "ric", "Relation_", "(_", "properties_", "._", "Property_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Person_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "name_" ]
[ 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, 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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, 4, 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
brosner/django-wikiapp/wiki/feeds.py
[ { "content": "from django.contrib.syndication.feeds import Feed, FeedDoesNotExist\nfrom django.utils.feedgenerator import Atom1Feed\nfrom django.contrib.contenttypes.models import ContentType\nfrom django.core.exceptions import ObjectDoesNotExist\nfrom django.core.urlresolvers import reverse\nfrom django.utils.translation import ugettext_lazy as _\nfrom django.http import Http404\nfrom django.shortcuts import get_object_or_404, render_to_response\nfrom django.template import Context, Template\nfrom django.template.loader import get_template\nfrom wiki.models import ChangeSet, Article\nfrom wiki.utils import get_ct\nimport atomformat as atom\n\nALL_ARTICLES = Article.objects.all()\nALL_CHANGES = ChangeSet.objects.all()\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class RssHistoryFeed(Feed):\n\n title = 'History for all articles'\n link = '/wiki/'\n description = 'Recent changes in wiki'\n\n\n ", "metadata": "root.RssHistoryFeed", "header": "['module', '___EOS___']", "index": 17 }, { "content": " def __init__(self, request,\n group_slug=None, bridge=None,\n article_qs=ALL_ARTICLES, changes_qs=ALL_CHANGES, \n extra_context=None, \n title_template = u'feeds/history_title.html', \n description_template = u'feeds/history_description.html', \n *args, **kw):\n\n if group_slug is not None:\n try:\n group = bridge.get_group(group_slug)\n except ObjectDoesNotExist:\n raise Http404\n self.changes_qs = changes_qs.filter(article__content_type=get_ct(group), \n article__object_id=group.id)\n else:\n self.changes_qs = changes_qs\n\n self.title_template = title_template\n self.description_template = description_template\n super(RssHistoryFeed, self).__init__('', request)", "metadata": "root.RssHistoryFeed.__init__", "header": "['class', 'RssHistoryFeed', '(', 'Feed', ')', ':', '___EOS___']", "index": 23 }, { "content": " def items(self):\n return self.changes_qs.order_by('-modified')[:30]", "metadata": "root.RssHistoryFeed.items", "header": "['class', 'RssHistoryFeed', '(', 'Feed', ')', ':', '___EOS___']", "index": 45 }, { "content": " def item_pubdate(self, item):\n \"\"\"\n Return the item's pubdate. It's this modified date\n \"\"\"\n return item.modified", "metadata": "root.RssHistoryFeed.item_pubdate", "header": "['class', 'RssHistoryFeed', '(', 'Feed', ')', ':', '___EOS___']", "index": 48 }, { "content": "class AtomHistoryFeed(atom.Feed):\n\n feed_title = 'History for all articles'\n feed_subtitle = 'Recent changes in wiki'\n\n\n\n\n\n\n\n\n", "metadata": "root.AtomHistoryFeed", "header": "['module', '___EOS___']", "index": 55 }, { "content": " def __init__(self, request,\n group_slug=None, bridge=None, \n article_qs=ALL_ARTICLES, changes_qs=ALL_CHANGES, \n extra_context=None, \n title_template = u'feeds/history_title.html', \n description_template = u'feeds/history_description.html', \n *args, **kw):\n\n if group_slug is not None:\n try:\n group = bridge.get_group(group_slug)\n except ObjectDoesNotExist:\n raise Http404\n self.changes_qs = changes_qs.filter(article__content_type=get_ct(group), \n article__object_id=group.id)\n else:\n self.changes_qs = changes_qs\n\n self.title_template = get_template(title_template)\n self.description_template = get_template(description_template)\n super(AtomHistoryFeed, self).__init__('', request)", "metadata": "root.AtomHistoryFeed.__init__", "header": "['class', 'AtomHistoryFeed', '(', 'atom', '.', 'Feed', ')', ':', '___EOS___']", "index": 60 }, { "content": " def feed_id(self):\n return \"feed_id\"", "metadata": "root.AtomHistoryFeed.feed_id", "header": "['class', 'AtomHistoryFeed', '(', 'atom', '.', 'Feed', ')', ':', '___EOS___']", "index": 82 }, { "content": " def items(self):\n return self.changes_qs.order_by('-modified')[:30]", "metadata": "root.AtomHistoryFeed.items", "header": "['class', 'AtomHistoryFeed', '(', 'atom', '.', 'Feed', ')', ':', '___EOS___']", "index": 85 }, { "content": " def item_id(self, item):\n return \"%s\" % item.id", "metadata": "root.AtomHistoryFeed.item_id", "header": "['class', 'AtomHistoryFeed', '(', 'atom', '.', 'Feed', ')', ':', '___EOS___']", "index": 88 }, { "content": " def item_title(self, item):\n c = Context({'obj' : item})\n return self.title_template.render(c)", "metadata": "root.AtomHistoryFeed.item_title", "header": "['class', 'AtomHistoryFeed', '(', 'atom', '.', 'Feed', ')', ':', '___EOS___']", "index": 91 }, { "content": " def item_updated(self, item):\n return item.modified", "metadata": "root.AtomHistoryFeed.item_updated", "header": "['class', 'AtomHistoryFeed', '(', 'atom', '.', 'Feed', ')', ':', '___EOS___']", "index": 95 }, { "content": " def item_authors(self, item):\n if item.is_anonymous_change():\n return [{'name' : _('Anonimous')},]\n return [{'name' : item.editor.username},]", "metadata": "root.AtomHistoryFeed.item_authors", "header": "['class', 'AtomHistoryFeed', '(', 'atom', '.', 'Feed', ')', ':', '___EOS___']", "index": 98 }, { "content": " def item_links(self, item):\n return [{'href': item.get_absolute_url()}, ]", "metadata": "root.AtomHistoryFeed.item_links", "header": "['class', 'AtomHistoryFeed', '(', 'atom', '.', 'Feed', ')', ':', '___EOS___']", "index": 103 }, { "content": " def item_content(self, item):\n c = Context({'obj' : item,})\n return ({'type': 'html'}, self.description_template.render(c))", "metadata": "root.AtomHistoryFeed.item_content", "header": "['class', 'AtomHistoryFeed', '(', 'atom', '.', 'Feed', ')', ':', '___EOS___']", "index": 106 }, { "content": "class RssArticleHistoryFeed(Feed):\n\n\n\n\n\n\n", "metadata": "root.RssArticleHistoryFeed", "header": "['module', '___EOS___']", "index": 111 }, { "content": " def __init__(self, title, request, \n group_slug=None, bridge=None,\n article_qs=ALL_ARTICLES, changes_qs=ALL_CHANGES,\n extra_context=None,\n title_template = u'feeds/history_title.html',\n description_template = u'feeds/history_description.html',\n *args, **kw):\n\n if group_slug is not None:\n try:\n group = bridge.get_group(group_slug)\n except ObjectDoesNotExist:\n raise Http404\n self.article_qs = article_qs.filter(content_type=get_ct(group),\n object_id=group.id)\n else:\n self.article_qs = article_qs\n\n self.title_template = title_template\n self.description_template = description_template\n super(RssArticleHistoryFeed, self).__init__(title, request)", "metadata": "root.RssArticleHistoryFeed.__init__", "header": "['class', 'RssArticleHistoryFeed', '(', 'Feed', ')', ':', '___EOS___']", "index": 113 }, { "content": " def get_object(self, bits):\n return self.article_qs.get(title = bits[0])", "metadata": "root.RssArticleHistoryFeed.get_object", "header": "['class', 'RssArticleHistoryFeed', '(', 'Feed', ')', ':', '___EOS___']", "index": 135 }, { "content": " def title(self, obj):\n return \"History for: %s \" % obj.title", "metadata": "root.RssArticleHistoryFeed.title", "header": "['class', 'RssArticleHistoryFeed', '(', 'Feed', ')', ':', '___EOS___']", "index": 138 }, { "content": " def link(self, obj):\n if not obj:\n raise FeedDoesNotExist\n return obj.get_absolute_url()", "metadata": "root.RssArticleHistoryFeed.link", "header": "['class', 'RssArticleHistoryFeed', '(', 'Feed', ')', ':', '___EOS___']", "index": 141 }, { "content": " def description(self, obj):\n return \"Recent changes in %s\" % obj.title", "metadata": "root.RssArticleHistoryFeed.description", "header": "['class', 'RssArticleHistoryFeed', '(', 'Feed', ')', ':', '___EOS___']", "index": 146 }, { "content": " def items(self, obj):\n return ChangeSet.objects.filter(article__id__exact=obj.id).order_by('-modified')[:30]", "metadata": "root.RssArticleHistoryFeed.items", "header": "['class', 'RssArticleHistoryFeed', '(', 'Feed', ')', ':', '___EOS___']", "index": 149 }, { "content": " def item_pubdate(self, item):\n \"\"\"\n Returns the modified date\n \"\"\"\n return item.modified", "metadata": "root.RssArticleHistoryFeed.item_pubdate", "header": "['class', 'RssArticleHistoryFeed', '(', 'Feed', ')', ':', '___EOS___']", "index": 152 }, { "content": "class AtomArticleHistoryFeed(atom.Feed):\n \n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.AtomArticleHistoryFeed", "header": "['module', '___EOS___']", "index": 159 }, { "content": " def __init__(self, title, request, \n group_slug=None, bridge=None,\n article_qs=ALL_ARTICLES, changes_qs=ALL_CHANGES,\n extra_context=None,\n title_template = u'feeds/history_title.html',\n description_template = u'feeds/history_description.html',\n *args, **kw):\n\n if group_slug is not None:\n try:\n group = bridge.get_group(group_slug)\n except ObjectDoesNotExist:\n raise Http404\n self.article_qs = article_qs.filter(content_type=get_ct(group),\n object_id=group.id)\n else:\n self.article_qs = article_qs\n\n self.title_template = get_template(title_template)\n self.description_template = get_template(description_template)\n super(AtomArticleHistoryFeed, self).__init__('', request)", "metadata": "root.AtomArticleHistoryFeed.__init__", "header": "['class', 'AtomArticleHistoryFeed', '(', 'atom', '.', 'Feed', ')', ':', '___EOS___']", "index": 161 }, { "content": " def get_object(self, bits):\n return self.article_qs.get(title = bits[0])", "metadata": "root.AtomArticleHistoryFeed.get_object", "header": "['class', 'AtomArticleHistoryFeed', '(', 'atom', '.', 'Feed', ')', ':', '___EOS___']", "index": 183 }, { "content": " def feed_title(self, obj):\n return \"History for: %s \" % obj.title", "metadata": "root.AtomArticleHistoryFeed.feed_title", "header": "['class', 'AtomArticleHistoryFeed', '(', 'atom', '.', 'Feed', ')', ':', '___EOS___']", "index": 186 }, { "content": " def feed_subtitle(self, obj):\n return \"Recent changes in %s\" % obj.title", "metadata": "root.AtomArticleHistoryFeed.feed_subtitle", "header": "['class', 'AtomArticleHistoryFeed', '(', 'atom', '.', 'Feed', ')', ':', '___EOS___']", "index": 189 }, { "content": " def feed_id(self):\n return \"feed_id\"", "metadata": "root.AtomArticleHistoryFeed.feed_id", "header": "['class', 'AtomArticleHistoryFeed', '(', 'atom', '.', 'Feed', ')', ':', '___EOS___']", "index": 192 }, { "content": " def items(self, obj):\n return ChangeSet.objects.filter(article__id__exact=obj.id).order_by('-modified')[:30]", "metadata": "root.AtomArticleHistoryFeed.items", "header": "['class', 'AtomArticleHistoryFeed', '(', 'atom', '.', 'Feed', ')', ':', '___EOS___']", "index": 195 }, { "content": " def item_id(self, item):\n return \"%s\" % item.id", "metadata": "root.AtomArticleHistoryFeed.item_id", "header": "['class', 'AtomArticleHistoryFeed', '(', 'atom', '.', 'Feed', ')', ':', '___EOS___']", "index": 198 }, { "content": " def item_title(self, item):\n c = Context({'obj' : item})\n return self.title_template.render(c)", "metadata": "root.AtomArticleHistoryFeed.item_title", "header": "['class', 'AtomArticleHistoryFeed', '(', 'atom', '.', 'Feed', ')', ':', '___EOS___']", "index": 201 }, { "content": " def item_updated(self, item):\n return item.modified", "metadata": "root.AtomArticleHistoryFeed.item_updated", "header": "['class', 'AtomArticleHistoryFeed', '(', 'atom', '.', 'Feed', ')', ':', '___EOS___']", "index": 205 }, { "content": " def item_authors(self, item):\n if item.is_anonymous_change():\n return [{'name' : _('Anonimous')},]\n return [{'name' : item.editor.username},]", "metadata": "root.AtomArticleHistoryFeed.item_authors", "header": "['class', 'AtomArticleHistoryFeed', '(', 'atom', '.', 'Feed', ')', ':', '___EOS___']", "index": 208 }, { "content": " def item_links(self, item):\n return [{'href': item.get_absolute_url()},]", "metadata": "root.AtomArticleHistoryFeed.item_links", "header": "['class', 'AtomArticleHistoryFeed', '(', 'atom', '.', 'Feed', ')', ':', '___EOS___']", "index": 213 }, { "content": " def item_content(self, item):\n c = Context({'obj' : item, })\n return ({'type': 'html'}, self.description_template.render(c))", "metadata": "root.AtomArticleHistoryFeed.item_content", "header": "['class', 'AtomArticleHistoryFeed', '(', 'atom', '.', 'Feed', ')', ':', '___EOS___']", "index": 216 } ]
[ { "span": "from django.utils.feedgenerator import Atom1Feed", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 48 }, { "span": "from django.contrib.contenttypes.models import ContentType", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 58 }, { "span": "from django.core.urlresolvers import reverse", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 44 }, { "span": "from django.shortcuts import get_object_or_404, render_to_response", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 66 }, { "span": "from django.template import Context, Template", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 45 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "syn", "dicat", "ion_", "._", "feeds_", "import_", "Feed_", ",_", "Feed", "Do", "es", "Not", "Exist_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "feed", "generator_", "import_", "Atom", "1", "Feed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "contenttype", "s_", "._", "models_", "import_", "Conten", "t", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "exceptions_", "import_", "Object", "Do", "es", "Not", "Exist_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "urlresolvers_", "import_", "reverse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "translation_", "import_", "uge", "ttext", "\\u", "lazy_", "as_", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "http_", "import_", "Http404_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "shortcuts_", "import_", "get", "\\u", "object\\u", "or", "\\u", "404_", ",_", "render", "\\u", "to", "\\u", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "template_", "import_", "Context_", ",_", "Template_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "template_", "._", "loader_", "import_", "get", "\\u", "template_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "wiki_", "._", "models_", "import_", "Change", "Set_", ",_", "Article_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "wiki_", "._", "utils_", "import_", "get", "\\u", "ct_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "atom", "format_", "as_", "atom_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ALL", "\\u", "ARTI", "CLE", "S_", "=_", "Article_", "._", "objects_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ALL", "\\u", "CHANGE", "S_", "=_", "Change", "Set_", "._", "objects_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Rs", "s", "Hist", "ory", "Feed_", "(_", "Feed_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "title_", "=_", "'", "Hist", "ory", " ", "for", " ", "all", " ", "article", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "link_", "=_", "'/", "wiki", "/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "description_", "=_", "'", "Rece", "nt", " ", "change", "s", " ", "in", " ", "wiki", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Rs", "s", "Hist", "ory", "Feed_", "(_", "Feed_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "group", "\\u", "slug_", "=_", "None_", ",_", "bridge_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "article", "\\u", "qs_", "=_", "ALL", "\\u", "ARTI", "CLE", "S_", ",_", "change", "s", "\\u", "qs_", "=_", "ALL", "\\u", "CHANGE", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extra", "\\u", "context_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "title", "\\u", "template_", "=_", "u", "'", "feed", "s", "/", "histo", "ry", "\\u", "title", ".", "html", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description", "\\u", "template_", "=_", "u", "'", "feed", "s", "/", "histo", "ry", "\\u", "description", ".", "html", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "*_", "args_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "group", "\\u", "slug_", "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 ", " _", "group_", "=_", "bridge_", "._", "get", "\\u", "group_", "(_", "group", "\\u", "slug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Object", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Http404_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "change", "s", "\\u", "qs_", "=_", "change", "s", "\\u", "qs_", "._", "filter_", "(_", "article", "\\u\\u", "content", "\\u", "type_", "=_", "get", "\\u", "ct_", "(_", "group_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "article", "\\u\\u", "object\\u", "id_", "=_", "group_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "change", "s", "\\u", "qs_", "=_", "change", "s", "\\u", "qs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "title", "\\u", "template_", "=_", "title", "\\u", "template_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "description", "\\u", "template_", "=_", "description", "\\u", "template_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Rs", "s", "Hist", "ory", "Feed_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "''_", ",_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rs", "s", "Hist", "ory", "Feed_", "(_", "Feed_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "items_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "change", "s", "\\u", "qs_", "._", "order", "\\u", "by_", "(_", "'-", "modifi", "ed", "'_", ")_", "[_", ":_", "30_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rs", "s", "Hist", "ory", "Feed_", "(_", "Feed_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "item", "\\u", "pub", "date_", "(_", "self_", ",_", "item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "the", " ", "item", "'", "s", " ", "pub", "date", ".", " ", "It", "'", "s", " ", "this", " ", "modifi", "ed", " ", "date", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "item_", "._", "modified_", "\\u\\u\\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_", "Atom", "Hist", "ory", "Feed_", "(_", "atom_", "._", "Feed_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "feed", "\\u", "title_", "=_", "'", "Hist", "ory", " ", "for", " ", "all", " ", "article", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "feed", "\\u", "subtitle_", "=_", "'", "Rece", "nt", " ", "change", "s", " ", "in", " ", "wiki", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Atom", "Hist", "ory", "Feed_", "(_", "atom_", "._", "Feed_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "group", "\\u", "slug_", "=_", "None_", ",_", "bridge_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "article", "\\u", "qs_", "=_", "ALL", "\\u", "ARTI", "CLE", "S_", ",_", "change", "s", "\\u", "qs_", "=_", "ALL", "\\u", "CHANGE", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extra", "\\u", "context_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "title", "\\u", "template_", "=_", "u", "'", "feed", "s", "/", "histo", "ry", "\\u", "title", ".", "html", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description", "\\u", "template_", "=_", "u", "'", "feed", "s", "/", "histo", "ry", "\\u", "description", ".", "html", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "*_", "args_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "group", "\\u", "slug_", "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 ", " _", "group_", "=_", "bridge_", "._", "get", "\\u", "group_", "(_", "group", "\\u", "slug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Object", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Http404_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "change", "s", "\\u", "qs_", "=_", "change", "s", "\\u", "qs_", "._", "filter_", "(_", "article", "\\u\\u", "content", "\\u", "type_", "=_", "get", "\\u", "ct_", "(_", "group_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "article", "\\u\\u", "object\\u", "id_", "=_", "group_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "change", "s", "\\u", "qs_", "=_", "change", "s", "\\u", "qs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "title", "\\u", "template_", "=_", "get", "\\u", "template_", "(_", "title", "\\u", "template_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "description", "\\u", "template_", "=_", "get", "\\u", "template_", "(_", "description", "\\u", "template_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Atom", "Hist", "ory", "Feed_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "''_", ",_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Atom", "Hist", "ory", "Feed_", "(_", "atom_", "._", "Feed_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "feed", "\\u", "id_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "feed", "\\u", "id", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Atom", "Hist", "ory", "Feed_", "(_", "atom_", "._", "Feed_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "items_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "change", "s", "\\u", "qs_", "._", "order", "\\u", "by_", "(_", "'-", "modifi", "ed", "'_", ")_", "[_", ":_", "30_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Atom", "Hist", "ory", "Feed_", "(_", "atom_", "._", "Feed_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "item", "\\u", "id_", "(_", "self_", ",_", "item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"%", "s", "\"_", "%_", "item_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Atom", "Hist", "ory", "Feed_", "(_", "atom_", "._", "Feed_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "item", "\\u", "title_", "(_", "self_", ",_", "item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "Context_", "(_", "{_", "'", "obj", "'_", ":_", "item_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "title", "\\u", "template_", "._", "render_", "(_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Atom", "Hist", "ory", "Feed_", "(_", "atom_", "._", "Feed_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "item", "\\u", "updated_", "(_", "self_", ",_", "item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "item_", "._", "modified_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Atom", "Hist", "ory", "Feed_", "(_", "atom_", "._", "Feed_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "item", "\\u", "authors_", "(_", "self_", ",_", "item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "item_", "._", "is", "\\u", "anonym", "ous", "\\u", "change_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "{_", "'", "name", "'_", ":_", "\\u_", "(_", "'", "Ano", "nim", "ous", "'_", ")_", "}_", ",_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "[_", "{_", "'", "name", "'_", ":_", "item_", "._", "editor_", "._", "username_", "}_", ",_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Atom", "Hist", "ory", "Feed_", "(_", "atom_", "._", "Feed_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "item", "\\u", "links_", "(_", "self_", ",_", "item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "{_", "'", "href", "'_", ":_", "item_", "._", "get", "\\u", "abs", "olute", "\\u", "url_", "(_", ")_", "}_", ",_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Atom", "Hist", "ory", "Feed_", "(_", "atom_", "._", "Feed_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "item", "\\u", "content_", "(_", "self_", ",_", "item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "Context_", "(_", "{_", "'", "obj", "'_", ":_", "item_", ",_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "{_", "'", "type", "'_", ":_", "'", "html", "'_", "}_", ",_", "self_", "._", "description", "\\u", "template_", "._", "render_", "(_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Rs", "s", "Artic", "le", "Hist", "ory", "Feed_", "(_", "Feed_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Rs", "s", "Artic", "le", "Hist", "ory", "Feed_", "(_", "Feed_", ")_", ":_", "\\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_", ",_", "title_", ",_", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "group", "\\u", "slug_", "=_", "None_", ",_", "bridge_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "article", "\\u", "qs_", "=_", "ALL", "\\u", "ARTI", "CLE", "S_", ",_", "change", "s", "\\u", "qs_", "=_", "ALL", "\\u", "CHANGE", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extra", "\\u", "context_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "title", "\\u", "template_", "=_", "u", "'", "feed", "s", "/", "histo", "ry", "\\u", "title", ".", "html", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description", "\\u", "template_", "=_", "u", "'", "feed", "s", "/", "histo", "ry", "\\u", "description", ".", "html", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "*_", "args_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "group", "\\u", "slug_", "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 ", " _", "group_", "=_", "bridge_", "._", "get", "\\u", "group_", "(_", "group", "\\u", "slug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Object", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Http404_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "article", "\\u", "qs_", "=_", "article", "\\u", "qs_", "._", "filter_", "(_", "content", "\\u", "type_", "=_", "get", "\\u", "ct_", "(_", "group_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "object\\u", "id_", "=_", "group_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "article", "\\u", "qs_", "=_", "article", "\\u", "qs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "title", "\\u", "template_", "=_", "title", "\\u", "template_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "description", "\\u", "template_", "=_", "description", "\\u", "template_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Rs", "s", "Artic", "le", "Hist", "ory", "Feed_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "title_", ",_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rs", "s", "Artic", "le", "Hist", "ory", "Feed_", "(_", "Feed_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "object_", "(_", "self_", ",_", "bits_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "article", "\\u", "qs_", "._", "get_", "(_", "title_", "=_", "bits_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rs", "s", "Artic", "le", "Hist", "ory", "Feed_", "(_", "Feed_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "title_", "(_", "self_", ",_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "Hist", "ory", " ", "for", ":", " ", "%", "s", " ", "\"_", "%_", "obj_", "._", "title_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rs", "s", "Artic", "le", "Hist", "ory", "Feed_", "(_", "Feed_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "link_", "(_", "self_", ",_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "obj_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Feed", "Do", "es", "Not", "Exist_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "obj_", "._", "get", "\\u", "abs", "olute", "\\u", "url_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rs", "s", "Artic", "le", "Hist", "ory", "Feed_", "(_", "Feed_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "description_", "(_", "self_", ",_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "Rece", "nt", " ", "change", "s", " ", "in", " ", "%", "s", "\"_", "%_", "obj_", "._", "title_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rs", "s", "Artic", "le", "Hist", "ory", "Feed_", "(_", "Feed_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "items_", "(_", "self_", ",_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Change", "Set_", "._", "objects_", "._", "filter_", "(_", "article", "\\u\\u", "id", "\\u\\u", "exact_", "=_", "obj_", "._", "id_", ")_", "._", "order", "\\u", "by_", "(_", "'-", "modifi", "ed", "'_", ")_", "[_", ":_", "30_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rs", "s", "Artic", "le", "Hist", "ory", "Feed_", "(_", "Feed_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "item", "\\u", "pub", "date_", "(_", "self_", ",_", "item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "modifi", "ed", " ", "date", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "item_", "._", "modified_", "\\u\\u\\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_", "Atom", "Artic", "le", "Hist", "ory", "Feed_", "(_", "atom_", "._", "Feed_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Atom", "Artic", "le", "Hist", "ory", "Feed_", "(_", "atom_", "._", "Feed_", ")_", ":_", "\\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_", ",_", "title_", ",_", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "group", "\\u", "slug_", "=_", "None_", ",_", "bridge_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "article", "\\u", "qs_", "=_", "ALL", "\\u", "ARTI", "CLE", "S_", ",_", "change", "s", "\\u", "qs_", "=_", "ALL", "\\u", "CHANGE", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extra", "\\u", "context_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "title", "\\u", "template_", "=_", "u", "'", "feed", "s", "/", "histo", "ry", "\\u", "title", ".", "html", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description", "\\u", "template_", "=_", "u", "'", "feed", "s", "/", "histo", "ry", "\\u", "description", ".", "html", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "*_", "args_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "group", "\\u", "slug_", "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 ", " _", "group_", "=_", "bridge_", "._", "get", "\\u", "group_", "(_", "group", "\\u", "slug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Object", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Http404_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "article", "\\u", "qs_", "=_", "article", "\\u", "qs_", "._", "filter_", "(_", "content", "\\u", "type_", "=_", "get", "\\u", "ct_", "(_", "group_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "object\\u", "id_", "=_", "group_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "article", "\\u", "qs_", "=_", "article", "\\u", "qs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "title", "\\u", "template_", "=_", "get", "\\u", "template_", "(_", "title", "\\u", "template_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "description", "\\u", "template_", "=_", "get", "\\u", "template_", "(_", "description", "\\u", "template_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Atom", "Artic", "le", "Hist", "ory", "Feed_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "''_", ",_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Atom", "Artic", "le", "Hist", "ory", "Feed_", "(_", "atom_", "._", "Feed_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "object_", "(_", "self_", ",_", "bits_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "article", "\\u", "qs_", "._", "get_", "(_", "title_", "=_", "bits_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Atom", "Artic", "le", "Hist", "ory", "Feed_", "(_", "atom_", "._", "Feed_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "feed", "\\u", "title_", "(_", "self_", ",_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "Hist", "ory", " ", "for", ":", " ", "%", "s", " ", "\"_", "%_", "obj_", "._", "title_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Atom", "Artic", "le", "Hist", "ory", "Feed_", "(_", "atom_", "._", "Feed_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "feed", "\\u", "subtitle_", "(_", "self_", ",_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "Rece", "nt", " ", "change", "s", " ", "in", " ", "%", "s", "\"_", "%_", "obj_", "._", "title_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Atom", "Artic", "le", "Hist", "ory", "Feed_", "(_", "atom_", "._", "Feed_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "feed", "\\u", "id_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "feed", "\\u", "id", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Atom", "Artic", "le", "Hist", "ory", "Feed_", "(_", "atom_", "._", "Feed_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "items_", "(_", "self_", ",_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Change", "Set_", "._", "objects_", "._", "filter_", "(_", "article", "\\u\\u", "id", "\\u\\u", "exact_", "=_", "obj_", "._", "id_", ")_", "._", "order", "\\u", "by_", "(_", "'-", "modifi", "ed", "'_", ")_", "[_", ":_", "30_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Atom", "Artic", "le", "Hist", "ory", "Feed_", "(_", "atom_", "._", "Feed_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "item", "\\u", "id_", "(_", "self_", ",_", "item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"%", "s", "\"_", "%_", "item_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Atom", "Artic", "le", "Hist", "ory", "Feed_", "(_", "atom_", "._", "Feed_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "item", "\\u", "title_", "(_", "self_", ",_", "item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "Context_", "(_", "{_", "'", "obj", "'_", ":_", "item_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "title", "\\u", "template_", "._", "render_", "(_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Atom", "Artic", "le", "Hist", "ory", "Feed_", "(_", "atom_", "._", "Feed_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "item", "\\u", "updated_", "(_", "self_", ",_", "item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "item_", "._", "modified_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Atom", "Artic", "le", "Hist", "ory", "Feed_", "(_", "atom_", "._", "Feed_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "item", "\\u", "authors_", "(_", "self_", ",_", "item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "item_", "._", "is", "\\u", "anonym", "ous", "\\u", "change_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "{_", "'", "name", "'_", ":_", "\\u_", "(_", "'", "Ano", "nim", "ous", "'_", ")_", "}_", ",_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "[_", "{_", "'", "name", "'_", ":_", "item_", "._", "editor_", "._", "username_", "}_", ",_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Atom", "Artic", "le", "Hist", "ory", "Feed_", "(_", "atom_", "._", "Feed_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "item", "\\u", "links_", "(_", "self_", ",_", "item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "{_", "'", "href", "'_", ":_", "item_", "._", "get", "\\u", "abs", "olute", "\\u", "url_", "(_", ")_", "}_", ",_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Atom", "Artic", "le", "Hist", "ory", "Feed_", "(_", "atom_", "._", "Feed_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "item", "\\u", "content_", "(_", "self_", ",_", "item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "Context_", "(_", "{_", "'", "obj", "'_", ":_", "item_", ",_", "}_", ")_", "\\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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Testing equality to None
OpenBCI/OpenBCI_Python/user.py
[ { "content": "#!/usr/bin/env python2.7\nimport argparse # new in Python2.7\nimport os\nimport time\nimport string\nimport atexit\nimport threading\nimport logging\nimport sys\n\nfrom yapsy.PluginManager import PluginManager\n\n# Load the plugins from the plugin directory.\nmanager = PluginManager()\nmanager.setPluginPlaces([\"plugins\"])\nmanager.collectPlugins()\n\nif __name__ == '__main__':\n\n print (\" USER.py\")\n parser = argparse.ArgumentParser(description=\"OpenBCI 'user'\")\n parser.add_argument('--board', default=3, type=int)\n parser.add_argument('-l', '--list', action='store_true',\n help=\"List available plugins.\")\n parser.add_argument('-i', '--info', metavar='PLUGIN',\n help=\"Show more information about a plugin.\")\n parser.add_argument('-p', '--port',\n help=\"Port to connect to OpenBCI Dongle \" +\n \"( ex /dev/ttyUSB0 or /dev/tty.usbserial-* )\")\n # baud rate is not currently used\n parser.add_argument('-b', '--baud', default=115200, type=int,\n help=\"Baud rate (not currently used)\")\n parser.add_argument('--no-filtering', dest='filtering',\n action='store_false',\n help=\"Disable notch filtering\")\n parser.set_defaults(filtering=True)\n parser.add_argument('-d', '--daisy', dest='daisy',\n action='store_true',\n help=\"Force daisy mode (beta feature)\")\n # first argument: plugin name, then parameters for plugin\n parser.add_argument('-a', '--add', metavar=('PLUGIN', 'PARAM'),\n action='append', nargs='+',\n help=\"Select which plugins to activate and set parameters.\")\n parser.add_argument('--log', dest='log', action='store_true',\n help=\"Log program\")\n parser.set_defaults(daisy=False, log=False)\n\n args = parser.parse_args()\n\n if not (args.port or args.list or args.info):\n parser.error('No action requested. Use `--port serial_port` to connect to the bord; `--list` to show available plugins or `--info [plugin_name]` to get more information.')\n\n if args.board == 3:\n print (\"user.py: open_bci_v3...\")\n import open_bci_v3 as bci\n elif args.board == 4:\n print (\"user.py: open_bci_v_ganglion...\")\n import open_bci_v_ganglion as bci\n else:\n warn('Board type not recognized')\n\n # Print list of available plugins and exit\n if args.list:\n print (\"Available plugins:\")\n for plugin in manager.getAllPlugins():\n print (\"\\t-\", plugin.name)\n exit()\n\n # User wants more info about a plugin...\n if args.info:\n plugin = manager.getPluginByName(args.info)\n if plugin == None:\n # eg: if an import fail inside a plugin, yapsy skip it\n print (\"Error: [\", args.info, \"] not found or could not be loaded. Check name and requirements.\")\n else:\n print (plugin.description)\n plugin.plugin_object.show_help()\n exit()\n\n print (\"\\n------------SETTINGS-------------\")\n print (\"Notch filtering:\", args.filtering)\n\n # Logging\n if args.log:\n print (\"Logging Enabled: \" + str(args.log))\n logging.basicConfig(filename=\"OBCI.log\", format='%(asctime)s - %(levelname)s : %(message)s', level=logging.DEBUG)\n logging.getLogger('yapsy').setLevel(logging.DEBUG)\n logging.info('---------LOG START-------------')\n logging.info(args)\n else:\n print (\"user.py: Logging Disabled.\")\n\n print (\"\\n-------INSTANTIATING BOARD-------\")\n board = bci.OpenBCIBoard(port=args.port,\n daisy=args.daisy,\n filter_data=args.filtering,\n scaled_output=True,\n log=args.log)\n\n # Info about effective number of channels and sampling rate\n if board.daisy:\n print (\"Force daisy mode:\")\n else:\n print (\"No daisy:\")\n print (board.getNbEEGChannels(), \"EEG channels and\", board.getNbAUXChannels(), \"AUX channels at\", board.getSampleRate(), \"Hz.\")\n\n print (\"\\n------------PLUGINS--------------\")\n # Loop round the plugins and print their names.\n print (\"Found plugins:\")\n for plugin in manager.getAllPlugins():\n print (\"[\", plugin.name, \"]\")\n print()\n\n\n # Fetch plugins, try to activate them, add to the list if OK\n plug_list = []\n callback_list = []\n if args.add:\n for plug_candidate in args.add:\n # first value: plugin name, then optional arguments\n plug_name = plug_candidate[0]\n plug_args = plug_candidate[1:]\n # Try to find name\n plug = manager.getPluginByName(plug_name)\n if plug == None:\n # eg: if an import fail inside a plugin, yapsy skip it\n print (\"Error: [\", plug_name, \"] not found or could not be loaded. Check name and requirements.\")\n else:\n print (\"\\nActivating [\", plug_name, \"] plugin...\")\n if not plug.plugin_object.pre_activate(plug_args, sample_rate=board.getSampleRate(), eeg_channels=board.getNbEEGChannels(), aux_channels=board.getNbAUXChannels()):\n print (\"Error while activating [\", plug_name, \"], check output for more info.\")\n else:\n print (\"Plugin [\", plug_name, \"] added to the list\")\n plug_list.append(plug.plugin_object)\n callback_list.append(plug.plugin_object)\n\n if len(plug_list) == 0:\n print (\"WARNING: no plugin selected, you will only be able to communicate with the board.\")\n fun = None\n else:\n fun = callback_list\n\n\n atexit.register(cleanUp)\n\n print (\"--------------INFO---------------\")\n print (\"User serial interface enabled...\\n\\\nView command map at http://docs.openbci.com.\\n\\\nType /start to run -- and /stop before issuing new commands afterwards.\\n\\\nType /exit to exit. \\n\\\nBoard outputs are automatically printed as: \\n\\\n% <tab> message\\n\\\n$$$ signals end of message\")\n\n print(\"\\n-------------BEGIN---------------\")\n # Init board state\n # s: stop board streaming; v: soft reset of the 32-bit board (no effect with 8bit board)\n s = 'sv'\n # Tell the board to enable or not daisy module\n if board.daisy:\n s = s + 'C'\n else:\n s = s + 'c'\n # d: Channels settings back to default\n s = s + 'd'\n\n while(s != \"/exit\"):\n # Send char and wait for registers to set\n if (not s):\n pass\n elif(\"help\" in s):\n print (\"View command map at: \\\nhttp://docs.openbci.com/software/01-OpenBCI_SDK.\\n\\\nFor user interface: read README or view \\\nhttps://github.com/OpenBCI/OpenBCI_Python\")\n\n elif board.streaming and s != \"/stop\":\n print (\"Error: the board is currently streaming data, please type '/stop' before issuing new commands.\")\n else:\n # read silently incoming packet if set (used when stream is stopped)\n flush = False\n\n if('/' == s[0]):\n s = s[1:]\n rec = False # current command is recognized or fot\n\n if(\"T:\" in s):\n lapse = int(s[string.find(s, \"T:\")+2:])\n rec = True\n elif(\"t:\" in s):\n lapse = int(s[string.find(s, \"t:\")+2:])\n rec = True\n else:\n lapse = -1\n\n if(\"start\" in s):\n if(fun != None):\n # start streaming in a separate thread so we could always send commands in here\n boardThread = threading.Thread(target=board.start_streaming, args=(fun, lapse))\n boardThread.daemon = True # will stop on exit\n try:\n boardThread.start()\n except:\n raise\n else:\n print (\"No function loaded\")\n rec = True\n elif('test' in s):\n test = int(s[s.find(\"test\")+4:])\n board.test_signal(test)\n rec = True\n elif('stop' in s):\n board.stop()\n rec = True\n flush = True\n if rec == False:\n print(\"Command not recognized...\")\n\n elif s:\n for c in s:\n if sys.hexversion > 0x03000000:\n board.ser.write(bytes(c, 'utf-8'))\n else:\n board.ser.write(bytes(c))\n time.sleep(0.100)\n\n line = ''\n time.sleep(0.1) #Wait to see if the board has anything to report\n while board.ser.inWaiting():\n c = board.ser.read().decode('utf-8')\n line += c\n time.sleep(0.001)\n if (c == '\\n') and not flush:\n print('%\\t'+line[:-1])\n line = ''\n\n if not flush:\n print(line)\n\n # Take user input\n #s = input('--> ')\n if sys.hexversion > 0x03000000:\n s = input('--> ')\n else:\n s = raw_input('--> ')\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "plugin == None:", "start_line": 71, "start_column": 11, "end_line": 71, "end_column": 25 }, { "span": "plug == None:", "start_line": 124, "start_column": 15, "end_line": 124, "end_column": 27 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python", "2.7", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "argparse_", "#", " ", "new", " ", "in", " ", "Pyth", "on2", ".7_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "atexit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "threading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "yap", "sy_", "._", "Plug", "in", "Manager_", "import_", "Plug", "in", "Manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Load", " ", "the", " ", "plugin", "s", " ", "from", " ", "the", " ", "plugin", " ", "director", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "manager_", "=_", "Plug", "in", "Manager_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manager_", "._", "set", "Plug", "in", "Places", "_", "(_", "[_", "\"", "plugin", "s", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manager_", "._", "collect", "Plugins_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", " ", " ", " ", " ", "USER", ".", "py", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "=_", "argparse_", "._", "Arg", "ument", "Parser_", "(_", "description_", "=_", "\"", "Open", "BC", "I", " ", "'", "user", "'\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "board", "'_", ",_", "default_", "=_", "3_", ",_", "type_", "=_", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "l", "'_", ",_", "'--", "list", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "List", " ", "avail", "able", " ", "plugin", "s", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "i", "'_", ",_", "'--", "info", "'_", ",_", "metavar_", "=_", "'", "PLUGIN", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "Show", " ", "more", " ", "informati", "on", " ", "abo", "ut", " ", "a", " ", "plugin", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "p", "'_", ",_", "'--", "port", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "Port", " ", "to", " ", "connect", " ", "to", " ", "Open", "BC", "I", " ", "Don", "gle", " ", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"(", " ", "ex", " ", "/", "dev", "/", "tt", "y", "USB", "0", " ", "or", " ", "/", "dev", "/", "tt", "y", ".", "usb", "serial", "-*", " ", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "baud", " ", "rate", " ", "is", " ", "not", " ", "currentl", "y", " ", "used_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "b", "'_", ",_", "'--", "baud", "'_", ",_", "default_", "=_", "1152", "00_", ",_", "type_", "=_", "int_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "Ba", "ud", " ", "rate", " ", "(", "not", " ", "currentl", "y", " ", "used", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "no", "-", "filtering", "'_", ",_", "dest_", "=_", "'", "filtering", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "'", "store", "\\u", "fal", "se", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "Disa", "ble", " ", "not", "ch", " ", "filtering", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "set\\u", "defaults_", "(_", "filtering", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "d", "'_", ",_", "'--", "dai", "sy", "'_", ",_", "dest_", "=_", "'", "dai", "sy", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "Force", " ", "dai", "sy", " ", "mode", " ", "(", "beta", " ", "feature", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "first", " ", "argu", "ment", ":", " ", "plugin", " ", "name", ",", " ", "then", " ", "parameter", "s", " ", "for", " ", "plugin_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "a", "'_", ",_", "'--", "add", "'_", ",_", "metavar_", "=_", "(_", "'", "PLUGIN", "'_", ",_", "'", "PARAM", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "'", "append", "'_", ",_", "nargs_", "=_", "'+'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "Select", " ", "whi", "ch", " ", "plugin", "s", " ", "to", " ", "activat", "e", " ", "and", " ", "set", " ", "parameter", "s", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "log", "'_", ",_", "dest_", "=_", "'", "log", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "Log", " ", "program", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "set\\u", "defaults_", "(_", "dai", "sy_", "=_", "False_", ",_", "log_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "parser_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "(_", "args_", "._", "port_", "or_", "args_", "._", "list_", "or_", "args_", "._", "info_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parser_", "._", "error_", "(_", "'", "No", " ", "action", " ", "request", "ed", ".", " ", "Us", "e", " ", "`-", "-", "port", " ", "serial", "\\u", "port", "`", " ", "to", " ", "connect", " ", "to", " ", "the", " ", "bor", "d", ";", " ", "`-", "-", "list", "`", " ", "to", " ", "show", " ", "avail", "able", " ", "plugin", "s", " ", "or", " ", "`-", "-", "info", " ", "[", "plugin", "\\u", "name", "]`", " ", "to", " ", "get", " ", "more", " ", "informati", "on", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "args_", "._", "board_", "==_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "user", ".", "py", ":", " ", "open", "\\u", "bc", "i", "\\u", "v", "3", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "open", "\\u", "bc", "i", "\\u", "v3_", "as_", "bc", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "args_", "._", "board_", "==_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "user", ".", "py", ":", " ", "open", "\\u", "bc", "i", "\\u", "v", "\\u", "gang", "lio", "n", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "open", "\\u", "bc", "i", "\\u", "v", "\\u", "gang", "lio", "n_", "as_", "bc", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warn_", "(_", "'", "Boa", "rd", " ", "type", " ", "not", " ", "recognize", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Print", " ", "list", " ", "of", " ", "avail", "able", " ", "plugin", "s", " ", "and", " ", "exit_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "args_", "._", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Avail", "able", " ", "plugin", "s", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "plugin_", "in_", "manager_", "._", "get", "All", "Plugins_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"\\\\", "t", "-\"_", ",_", "plugin_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "User", " ", "want", "s", " ", "more", " ", "info", " ", "abo", "ut", " ", "a", " ", "plugin", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "args_", "._", "info_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plugin_", "=_", "manager_", "._", "get", "Plug", "in", "By", "Name_", "(_", "args_", "._", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "plugin_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "eg", ":", " ", "if", " ", "an", " ", "import", " ", "fail", " ", "insi", "de", " ", "a", " ", "plugin", ",", " ", "yap", "sy", " ", "skip", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Error", ":", " ", "[\"_", ",_", "args_", "._", "info_", ",_", "\"]", " ", "not", " ", "found", " ", "or", " ", "coul", "d", " ", "not", " ", "be", " ", "load", "ed", ".", " ", "Check", " ", "name", " ", "and", " ", "require", "ment", "s", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "plugin_", "._", "description_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plugin_", "._", "plugin", "\\u", "object_", "._", "show", "\\u", "help_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "\"\\\\", "n", "------------", "SETTING", "S", "-------------", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Not", "ch", " ", "filtering", ":\"_", ",_", "args_", "._", "filtering", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Logging_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "args_", "._", "log_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Log", "ging", " ", "Enable", "d", ":", " ", "\"_", "+_", "str_", "(_", "args_", "._", "log_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "basic", "Config_", "(_", "filename_", "=_", "\"", "OB", "CI", ".", "log", "\"_", ",_", "format_", "=_", "'%", "(", "asc", "time", ")", "s", " ", "-", " ", "%", "(", "level", "name", ")", "s", " ", ":", " ", "%", "(", "message", ")", "s", "'_", ",_", "level_", "=_", "logging_", "._", "DEBUG_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "get", "Logger_", "(_", "'", "yap", "sy", "'_", ")_", "._", "set", "Level_", "(_", "logging_", "._", "DEBUG_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "info_", "(_", "'-------", "--", "LOG", " ", "START", "-------------", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "info_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "user", ".", "py", ":", " ", "Log", "ging", " ", "Disa", "ble", "d", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "\"\\\\", "n", "-------", "INSTA", "NTI", "ATI", "NG", " ", "BOARD", "-------", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "board_", "=_", "bc", "i_", "._", "Open", "BC", "IB", "oard", "_", "(_", "port_", "=_", "args_", "._", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dai", "sy_", "=_", "args_", "._", "dai", "sy_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "filter", "\\u", "data_", "=_", "args_", "._", "filtering", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "scale", "d\\u", "output_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "=_", "args_", "._", "log_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Info", " ", "abo", "ut", " ", "effective", " ", "number", " ", "of", " ", "channel", "s", " ", "and", " ", "samp", "ling", " ", "rate_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "board_", "._", "dai", "sy_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Force", " ", "dai", "sy", " ", "mode", ":\"_", ")_", "\\u\\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_", "(_", "\"", "No", " ", "dai", "sy", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "board_", "._", "get", "Nb", "EE", "GC", "hannel", "s_", "(_", ")_", ",_", "\"", "EE", "G", " ", "channel", "s", " ", "and", "\"_", ",_", "board_", "._", "get", "Nb", "AUX", "Channels_", "(_", ")_", ",_", "\"", "AUX", " ", "channel", "s", " ", "at", "\"_", ",_", "board_", "._", "get", "Sampl", "e", "Rate_", "(_", ")_", ",_", "\"", "H", "z", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "\"\\\\", "n", "------------", "PLUGINS", "--------------", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Loop", " ", "round", " ", "the", " ", "plugin", "s", " ", "and", " ", "print", " ", "thei", "r", " ", "names", "._", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Foun", "d", " ", "plugin", "s", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "plugin_", "in_", "manager_", "._", "get", "All", "Plugins_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"[\"_", ",_", "plugin_", "._", "name_", ",_", "\"]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fe", "tch", " ", "plugin", "s", ",", " ", "try", " ", "to", " ", "activat", "e", " ", "them", ",", " ", "add", " ", "to", " ", "the", " ", "list", " ", "if", " ", "OK_", "\\u\\u\\uNL\\u\\u\\u_", "plug", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "callback", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "args_", "._", "add_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "plug", "\\u", "candidate_", "in_", "args_", "._", "add_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "first", " ", "value", ":", " ", "plugin", " ", "name", ",", " ", "then", " ", "option", "al", " ", "arguments_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plug", "\\u", "name_", "=_", "plug", "\\u", "candidate_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plug", "\\u", "args_", "=_", "plug", "\\u", "candidate_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Tr", "y", " ", "to", " ", "find", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "plug_", "=_", "manager_", "._", "get", "Plug", "in", "By", "Name_", "(_", "plug", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "plug_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "eg", ":", " ", "if", " ", "an", " ", "import", " ", "fail", " ", "insi", "de", " ", "a", " ", "plugin", ",", " ", "yap", "sy", " ", "skip", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Error", ":", " ", "[\"_", ",_", "plug", "\\u", "name_", ",_", "\"]", " ", "not", " ", "found", " ", "or", " ", "coul", "d", " ", "not", " ", "be", " ", "load", "ed", ".", " ", "Check", " ", "name", " ", "and", " ", "require", "ment", "s", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"\\\\", "n", "Activat", "ing", " ", "[\"_", ",_", "plug", "\\u", "name_", ",_", "\"]", " ", "plugin", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "plug_", "._", "plugin", "\\u", "object_", "._", "pre", "\\u", "activate_", "(_", "plug", "\\u", "args_", ",_", "sample", "\\u", "rate_", "=_", "board_", "._", "get", "Sampl", "e", "Rate_", "(_", ")_", ",_", "ee", "g", "\\u", "channels_", "=_", "board_", "._", "get", "Nb", "EE", "GC", "hannel", "s_", "(_", ")_", ",_", "aux", "\\u", "channels_", "=_", "board_", "._", "get", "Nb", "AUX", "Channels_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "(_", "\"", "Error", " ", "whi", "le", " ", "activat", "ing", " ", "[\"_", ",_", "plug", "\\u", "name_", ",_", "\"]", ",", " ", "check", " ", "output", " ", "for", " ", "more", " ", "info", ".\"_", ")_", "\\u\\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_", "(_", "\"", "Plug", "in", " ", "[\"_", ",_", "plug", "\\u", "name_", ",_", "\"]", " ", "adde", "d", " ", "to", " ", "the", " ", "list", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plug", "\\u", "list_", "._", "append_", "(_", "plug_", "._", "plugin", "\\u", "object_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "callback", "\\u", "list_", "._", "append_", "(_", "plug_", "._", "plugin", "\\u", "object_", ")_", "\\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_", "if_", "len_", "(_", "plug", "\\u", "list_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "WARN", "ING", ":", " ", "no", " ", "plugin", " ", "selecte", "d", ",", " ", "you", " ", "will", " ", "only", " ", "be", " ", "able", " ", "to", " ", "communi", "cate", " ", "with", " ", "the", " ", "board", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fun_", "=_", "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 ", " _", "fun_", "=_", "callback", "\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "atexit_", "._", "register_", "(_", "clean", "Up_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"-------", "-------", "INFO", "--------------", "-\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "User", " ", "serial", " ", "interface", " ", "enable", "d", "...", "\\\\", "n", "\\\\", "\\", "10", ";", "View", " ", "command", " ", "map", " ", "at", " ", "http", "://", "docs", ".", "openb", "ci", ".", "com", ".\\\\", "n", "\\\\", "\\", "10", ";", "Type", " ", "/", "start", " ", "to", " ", "run", " ", "--", " ", "and", " ", "/", "stop", " ", "bef", "ore", " ", "issu", "ing", " ", "new", " ", "command", "s", " ", "after", "ward", "s", ".\\\\", "n", "\\\\", "\\", "10", ";", "Type", " ", "/", "exit", " ", "to", " ", "exit", ".", " ", "\\\\", "n", "\\\\", "\\", "10", ";", "Boa", "rd", " ", "output", "s", " ", "are", " ", "automati", "call", "y", " ", "printed", " ", "as", ":", " ", "\\\\", "n", "\\\\", "\\", "10", ";", "%", " ", " ", "<", "tab", ">", " ", " ", "message", "\\\\", "n", "\\\\", "\\", "10", ";", "$$", "$", " ", "signal", "s", " ", "end", " ", "of", " ", "message", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"\\\\", "n", "-------------", "BEGIN", "--------------", "-\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ini", "t", " ", "board", " ", "state_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "s", ":", " ", "stop", " ", "board", " ", "stream", "ing", ";", " ", "v", ":", " ", "soft", " ", "reset", " ", "of", " ", "the", " ", "32", "-", "bit", " ", "board", " ", "(", "no", " ", "effect", " ", "with", " ", "8b", "it", " ", "board", ")_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "'", "sv", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Tell", " ", "the", " ", "board", " ", "to", " ", "enable", " ", "or", " ", "not", " ", "dai", "sy", " ", "module_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "board_", "._", "dai", "sy_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "s_", "+_", "'", "C", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "s_", "+_", "'", "c", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "d", ":", " ", "Chan", "nels", " ", "settings", " ", "back", " ", "to", " ", "default_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "=_", "s_", "+_", "'", "d", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "(_", "s_", "!=_", "\"/", "exit", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sen", "d", " ", "char", " ", "and", " ", "wait", " ", "for", " ", "register", "s", " ", "to", " ", "set_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "not_", "s_", ")_", ":_", "\\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_", "(_", "\"", "help", "\"_", "in_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "View", " ", "command", " ", "map", " ", "at", ":", " ", "\\\\", "\\", "10", ";", "http", "://", "docs", ".", "openb", "ci", ".", "com", "/", "software", "/", "01", "-", "Open", "BC", "I", "\\u", "SD", "K", ".\\\\", "n", "\\\\", "\\", "10", ";", "For", " ", "user", " ", "interface", ":", " ", "read", " ", "READ", "ME", " ", "or", " ", "view", " ", "\\\\", "\\", "10", ";", "https", "://", "git", "hub", ".", "com", "/", "Open", "BC", "I", "/", "Open", "BC", "I", "\\u", "Pyth", "on", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "board_", "._", "streaming_", "and_", "s_", "!=_", "\"/", "stop", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Error", ":", " ", "the", " ", "board", " ", "is", " ", "currentl", "y", " ", "stream", "ing", " ", "data", ",", " ", "plea", "se", " ", "type", " ", "'/", "stop", "'", " ", "bef", "ore", " ", "issu", "ing", " ", "new", " ", "command", "s", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "read", " ", "silently", " ", "inco", "ming", " ", "packet", " ", "if", " ", "set", " ", "(", "used", " ", "whe", "n", " ", "stream", " ", "is", " ", "stopp", "ed", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flush_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "'/'_", "==_", "s_", "[_", "0_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "s_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec_", "=_", "False_", "#", " ", "current", " ", "command", " ", "is", " ", "recognize", "d", " ", "or", " ", "fot", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "\"", "T", ":\"_", "in_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "lap", "se_", "=_", "int_", "(_", "s_", "[_", "string_", "._", "find_", "(_", "s_", ",_", "\"", "T", ":\"_", ")_", "+_", "2_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "\"", "t", ":\"_", "in_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "lap", "se_", "=_", "int_", "(_", "s_", "[_", "string_", "._", "find_", "(_", "s_", ",_", "\"", "t", ":\"_", ")_", "+_", "2_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec_", "=_", "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 ", " ", "_", "lap", "se_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "\"", "start", "\"_", "in_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "(_", "fun_", "!=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "start", " ", "stream", "ing", " ", "in", " ", "a", " ", "separate", " ", "thread", " ", "so", " ", "we", " ", "coul", "d", " ", "alw", "ay", "s", " ", "send", " ", "command", "s", " ", "in", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "board", "Thread_", "=_", "threading_", "._", "Thread_", "(_", "target_", "=_", "board_", "._", "start", "\\u", "streaming_", ",_", "args_", "=_", "(_", "fun_", ",_", "lap", "se_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "board", "Thread_", "._", "daemon_", "=_", "True_", "#", " ", "will", " ", "stop", " ", "on", " ", "exit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "board", "Thread_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "\\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_", "(_", "\"", "No", " ", "function", " ", "load", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rec_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "'", "test", "'_", "in_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "test_", "=_", "int_", "(_", "s_", "[_", "s_", "._", "find_", "(_", "\"", "test", "\"_", ")_", "+_", "4_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "board_", "._", "test\\u", "signal_", "(_", "test_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "'", "stop", "'_", "in_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "board_", "._", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flush_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "rec_", "==_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "(_", "\"", "Command", " ", "not", " ", "recognize", "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_", "elif_", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "c_", "in_", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "sys_", "._", "hex", "version_", ">_", "0x03", "000000_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "board_", "._", "ser_", "._", "write_", "(_", "bytes_", "(_", "c_", ",_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "board_", "._", "ser_", "._", "write_", "(_", "bytes_", "(_", "c_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.10", "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_", "line_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.1_", ")_", "#", "Wait", " ", "to", " ", "see", " ", "if", " ", "the", " ", "board", " ", "has", " ", "anyt", "hing", " ", "to", " ", "report_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "board_", "._", "ser_", "._", "in", "Wait", "ing_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "board_", "._", "ser_", "._", "read_", "(_", ")_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line_", "+=_", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.001_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "c_", "==_", "'\\\\", "n", "'_", ")_", "and_", "not_", "flush_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "(_", "'%", "\\\\", "t", "'_", "+_", "line_", "[_", ":_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line_", "=_", "''_", "\\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_", "flush_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tak", "e", " ", "user", " ", "input_", "\\u\\u\\uNL\\u\\u\\u_", "#", "s", " ", "=", " ", "input", "('", "-->", " ", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sys_", "._", "hex", "version_", ">_", "0x03", "000000_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "input_", "(_", "'--", ">", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "raw", "\\u", "input_", "(_", "'--", ">", " ", "'_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\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,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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
neurodata/ndstore/.old-EM-connectome/ingest/logan/catmaid.py
[ { "content": "# Copyright 2014 Open Connectome Project (http://openconnecto.me)\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 argparse\nimport sys\nimport os\n\nimport numpy as np\nfrom PIL import Image\nimport urllib, urllib2\nimport cStringIO\nimport collections\nimport zlib\n\n\"\"\"\n Make a CATMAID image stack from LIF files.\n\"\"\"\n\n\n\nif __name__ == \"__main__\":\n main()\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def main():\n\n parser = argparse.ArgumentParser(description='Build a CATMAID stack out of LIF raw export from Fiji')\n parser.add_argument('inputpath', action=\"store\", help='Directory with annotation PNG files.')\n parser.add_argument('outputpath', action=\"store\", help='Directory to store the tiles.')\n parser.add_argument('slices', action=\"store\", type=int)\n parser.add_argument('ximagesize', action=\"store\", type=int)\n parser.add_argument('yimagesize', action=\"store\", type=int)\n parser.add_argument('zoomlevels', action=\"store\", type=int, default=512)\n parser.add_argument('--color', action=\"store\", default ='R', help='One of RGBCMY. Default R' )\n parser.add_argument('--tilesize', action=\"store\", type=int, default=512)\n\n\n result = parser.parse_args()\n\n ximgsz = result.ximagesize\n yimgsz = result.yimagesize\n tilesz = result.tilesize\n zoomlevels = result.zoomlevels\n slices = result.slices\n\n # make the directory hierarchy\n if not os.path.exists ( os.path.abspath(result.outputpath) ):\n try:\n os.mkdir(os.path.abspath(result.outputpath))\n except:\n print \"Failed to create target directory\"\n elif not os.path.isdir(os.path.abspath(result.outputpath)):\n print \"Target directory is not a directory.\"\n sys.exit(-1)\n\n # and the zoom levels\n for l in range(zoomlevels):\n if not os.path.exists(os.path.abspath('%s/%s/'%(result.outputpath,l))):\n try:\n os.mkdir(os.path.abspath('%s/%s/'%(result.outputpath,l)))\n except:\n print \"Failed to create resolutions directories\"\n\n for sl in range (slices):\n for l in range(zoomlevels):\n\n # directory for each slices\n if not os.path.exists(os.path.abspath('%s/%s/%s'%(result.outputpath,l,sl))):\n try:\n os.mkdir(os.path.abspath('%s/%s/%s'%(result.outputpath,l,sl))) \n except:\n print \"Failed to create slice directories\"\n\n # raw data\n filenm = result.inputpath + '/' + '{:0>4}'.format(sl) + '.raw'\n print \"Opening filenm\" + filenm\n\n # Compute how many tiles\n xtiles = (ximgsz-1)/(tilesz*(2**l))+1\n ytiles = (yimgsz-1)/(tilesz*(2**l))+1\n xdim = xtiles*tilesz*(2**l)\n ydim = ytiles*tilesz*(2**l)\n\n # add the image data into the tile data\n tiledata = np.zeros ( [ydim,xdim], dtype=np.uint32 )\n imgdata = np.uint32(np.fromfile ( filenm, dtype=np.uint8 ).reshape([yimgsz,ximgsz]))\n\n # Pick a channel color\n if result.color == 'R':\n tiledata[0:imgdata.shape[0],0:imgdata.shape[1]] = imgdata + 0xFF000000\n elif result.color == 'G':\n tiledata[0:imgdata.shape[0],0:imgdata.shape[1]] = np.left_shift(imgdata,8) + 0xFF000000\n elif result.color == 'B':\n tiledata[0:imgdata.shape[0],0:imgdata.shape[1]] = np.left_shift(imgdata,16) + 0xFF000000\n elif result.color == 'C':\n tiledata[0:imgdata.shape[0],0:imgdata.shape[1]] = np.left_shift(imgdata,16) + np.left_shift(imgdata,8) + 0xFF000000\n elif result.color == 'M':\n tiledata[0:imgdata.shape[0],0:imgdata.shape[1]] = imgdata + np.left_shift(imgdata,16) + 0xFF000000\n elif result.color == 'Y':\n tiledata[0:imgdata.shape[0],0:imgdata.shape[1]] = imgdata + np.left_shift(imgdata,8) + 0xFF000000\n else:\n print \"Unknown color\"\n sys.exit(-1)\n\n # Write out the tiles\n for y in range(ytiles):\n for x in range(xtiles):\n outimg = Image.frombuffer ( 'RGBA', (tilesz*(2**l),tilesz*(2**l)), tiledata[y*tilesz*(2**l):(y+1)*tilesz*(2**l),x*tilesz*(2**l):(x+1)*tilesz*(2**l)].flatten(), 'raw', 'RGBA', 0, 1 )\n# outimg = Image.frombuffer ( 'L', (tilesz*(2**l),tilesz(2**l)), tiledata[y*tilesz*(2**l):(y+1)*tilesz*(2**l),x*tilesz*(2**l):(x+1)*tilesz*(2**l)].flatten(), 'raw', 'L', 0, 1 )\n outimg = outimg.resize ([tilesz,tilesz])\n outimg.save(os.path.abspath('%s/%s/%s/%s_%s.png'%(result.outputpath,l,sl,y,x)))\n print '%s/%s/%s/%s_%s.png'%(result.outputpath,l,sl,y,x)", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 29 } ]
[ { "span": "import urllib, urllib2", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 22 }, { "span": "import cStringIO", "start_line": 21, "start_column": 0, "end_line": 21, "end_column": 16 }, { "span": "import collections", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 18 }, { "span": "import zlib", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 11 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2014", " ", "Open", " ", "Connect", "ome", " ", "Project", " ", "(", "http", "://", "openco", "nnect", "o", ".", "me", ")_", "\\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_", "argparse_", "\\u\\u\\uNEWLINE\\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_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "PIL_", "import_", "Image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib_", ",_", "urllib2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "c", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "collections_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "zlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", "Make", " ", "a", " ", "CAT", "MA", "ID", " ", "image", " ", "stack", " ", "from", " ", "LIF", " ", "files", ".", "\\", "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\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "main_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parser_", "=_", "argparse_", "._", "Arg", "ument", "Parser_", "(_", "description_", "=_", "'", "Build", " ", "a", " ", "CAT", "MA", "ID", " ", "stack", " ", "out", " ", "of", " ", "LIF", " ", "raw", " ", "export", " ", "from", " ", "Fi", "ji", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'", "input", "path", "'_", ",_", "action_", "=_", "\"", "store", "\"_", ",_", "help_", "=_", "'", "Director", "y", " ", "with", " ", "annot", "ation", " ", "PNG", " ", "files", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'", "output", "path", "'_", ",_", "action_", "=_", "\"", "store", "\"_", ",_", "help_", "=_", "'", "Director", "y", " ", "to", " ", "store", " ", "the", " ", "tiles", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'", "slice", "s", "'_", ",_", "action_", "=_", "\"", "store", "\"_", ",_", "type_", "=_", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'", "xim", "age", "size", "'_", ",_", "action_", "=_", "\"", "store", "\"_", ",_", "type_", "=_", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'", "yi", "mage", "size", "'_", ",_", "action_", "=_", "\"", "store", "\"_", ",_", "type_", "=_", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'", "zoom", "level", "s", "'_", ",_", "action_", "=_", "\"", "store", "\"_", ",_", "type_", "=_", "int_", ",_", "default_", "=_", "512_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "color", "'_", ",_", "action_", "=_", "\"", "store", "\"_", ",_", "default_", "=_", "'", "R", "'_", ",_", "help_", "=_", "'", "One", " ", "of", " ", "RGB", "CM", "Y", ".", " ", "Default", " ", "R", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "tiles", "ize", "'_", ",_", "action_", "=_", "\"", "store", "\"_", ",_", "type_", "=_", "int_", ",_", "default_", "=_", "512_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "parser_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xim", "gs", "z_", "=_", "result_", "._", "xim", "age", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yi", "mg", "sz_", "=_", "result_", "._", "yi", "mage", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tiles", "z_", "=_", "result_", "._", "tiles", "ize_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zoom", "levels_", "=_", "result_", "._", "zoom", "levels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slices_", "=_", "result_", "._", "slices_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "the", " ", "director", "y", " ", "hierarchy_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "result_", "._", "output", "path_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "mkdir_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "result_", "._", "output", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Fail", "ed", " ", "to", " ", "create", " ", "target", " ", "director", "y", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "os_", "._", "path_", "._", "isdir_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "result_", "._", "output", "path_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Target", " ", "director", "y", " ", "is", " ", "not", " ", "a", " ", "director", "y", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "the", " ", "zoom", " ", "levels_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "l_", "in_", "range_", "(_", "zoom", "levels_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "'%", "s", "/", "%", "s", "/'_", "%_", "(_", "result_", "._", "output", "path_", ",_", "l_", ")_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "mkdir_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "'%", "s", "/", "%", "s", "/'_", "%_", "(_", "result_", "._", "output", "path_", ",_", "l_", ")_", ")_", ")_", "\\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_", "\"", "Fail", "ed", " ", "to", " ", "create", " ", "resolu", "tion", "s", " ", "director", "ies", "\"_", "\\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_", "sl_", "in_", "range_", "(_", "slices_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "l_", "in_", "range_", "(_", "zoom", "levels_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "director", "y", " ", "for", " ", "each", " ", "slices_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "'%", "s", "/", "%", "s", "/", "%", "s", "'_", "%_", "(_", "result_", "._", "output", "path_", ",_", "l_", ",_", "sl_", ")_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "mkdir_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "'%", "s", "/", "%", "s", "/", "%", "s", "'_", "%_", "(_", "result_", "._", "output", "path_", ",_", "l_", ",_", "sl_", ")_", ")_", ")_", "\\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_", "\"", "Fail", "ed", " ", "to", " ", "create", " ", "slice", " ", "director", "ies", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "raw", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "filen", "m_", "=_", "result_", "._", "input", "path_", "+_", "'/'_", "+_", "'{:", "0", ">", "4", "}'_", "._", "format_", "(_", "sl_", ")_", "+_", "'.", "raw", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Open", "ing", " ", "filen", "m", "\"_", "+_", "filen", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Compute", " ", "how", " ", "many", " ", "tiles_", "\\u\\u\\uNL\\u\\u\\u_", "xt", "iles_", "=_", "(_", "xim", "gs", "z_", "-_", "1_", ")_", "/_", "(_", "tiles", "z_", "*_", "(_", "2_", "**_", "l_", ")_", ")_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yti", "les_", "=_", "(_", "yi", "mg", "sz_", "-_", "1_", ")_", "/_", "(_", "tiles", "z_", "*_", "(_", "2_", "**_", "l_", ")_", ")_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xdi", "m_", "=_", "xt", "iles_", "*_", "tiles", "z_", "*_", "(_", "2_", "**_", "l_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ydi", "m_", "=_", "yti", "les_", "*_", "tiles", "z_", "*_", "(_", "2_", "**_", "l_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "the", " ", "image", " ", "data", " ", "int", "o", " ", "the", " ", "tile", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "tiled", "ata_", "=_", "np_", "._", "zeros_", "(_", "[_", "ydi", "m_", ",_", "xdi", "m_", "]_", ",_", "dtype_", "=_", "np_", "._", "uint32_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "img", "data_", "=_", "np_", "._", "uint32_", "(_", "np_", "._", "fromfile_", "(_", "filen", "m_", ",_", "dtype_", "=_", "np_", "._", "uint8_", ")_", "._", "reshape_", "(_", "[_", "yi", "mg", "sz_", ",_", "xim", "gs", "z_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pick", " ", "a", " ", "channel", " ", "color_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "result_", "._", "color_", "==_", "'", "R", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tiled", "ata_", "[_", "0_", ":_", "img", "data_", "._", "shape_", "[_", "0_", "]_", ",_", "0_", ":_", "img", "data_", "._", "shape_", "[_", "1_", "]_", "]_", "=_", "img", "data_", "+_", "0xFF", "000000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "result_", "._", "color_", "==_", "'", "G", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tiled", "ata_", "[_", "0_", ":_", "img", "data_", "._", "shape_", "[_", "0_", "]_", ",_", "0_", ":_", "img", "data_", "._", "shape_", "[_", "1_", "]_", "]_", "=_", "np_", "._", "left", "\\u", "shift_", "(_", "img", "data_", ",_", "8_", ")_", "+_", "0xFF", "000000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "result_", "._", "color_", "==_", "'", "B", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tiled", "ata_", "[_", "0_", ":_", "img", "data_", "._", "shape_", "[_", "0_", "]_", ",_", "0_", ":_", "img", "data_", "._", "shape_", "[_", "1_", "]_", "]_", "=_", "np_", "._", "left", "\\u", "shift_", "(_", "img", "data_", ",_", "16_", ")_", "+_", "0xFF", "000000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "result_", "._", "color_", "==_", "'", "C", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tiled", "ata_", "[_", "0_", ":_", "img", "data_", "._", "shape_", "[_", "0_", "]_", ",_", "0_", ":_", "img", "data_", "._", "shape_", "[_", "1_", "]_", "]_", "=_", "np_", "._", "left", "\\u", "shift_", "(_", "img", "data_", ",_", "16_", ")_", "+_", "np_", "._", "left", "\\u", "shift_", "(_", "img", "data_", ",_", "8_", ")_", "+_", "0xFF", "000000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "result_", "._", "color_", "==_", "'", "M", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tiled", "ata_", "[_", "0_", ":_", "img", "data_", "._", "shape_", "[_", "0_", "]_", ",_", "0_", ":_", "img", "data_", "._", "shape_", "[_", "1_", "]_", "]_", "=_", "img", "data_", "+_", "np_", "._", "left", "\\u", "shift_", "(_", "img", "data_", ",_", "16_", ")_", "+_", "0xFF", "000000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "result_", "._", "color_", "==_", "'", "Y", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tiled", "ata_", "[_", "0_", ":_", "img", "data_", "._", "shape_", "[_", "0_", "]_", ",_", "0_", ":_", "img", "data_", "._", "shape_", "[_", "1_", "]_", "]_", "=_", "img", "data_", "+_", "np_", "._", "left", "\\u", "shift_", "(_", "img", "data_", ",_", "8_", ")_", "+_", "0xFF", "000000_", "\\u\\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_", "\"", "Un", "know", "n", " ", "color", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Write", " ", "out", " ", "the", " ", "tiles_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "y_", "in_", "range_", "(_", "yti", "les_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "x_", "in_", "range_", "(_", "xt", "iles_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out", "img_", "=_", "Image_", "._", "from", "buffer_", "(_", "'", "RGB", "A", "'_", ",_", "(_", "tiles", "z_", "*_", "(_", "2_", "**_", "l_", ")_", ",_", "tiles", "z_", "*_", "(_", "2_", "**_", "l_", ")_", ")_", ",_", "tiled", "ata_", "[_", "y_", "*_", "tiles", "z_", "*_", "(_", "2_", "**_", "l_", ")_", ":_", "(_", "y_", "+_", "1_", ")_", "*_", "tiles", "z_", "*_", "(_", "2_", "**_", "l_", ")_", ",_", "x_", "*_", "tiles", "z_", "*_", "(_", "2_", "**_", "l_", ")_", ":_", "(_", "x_", "+_", "1_", ")_", "*_", "tiles", "z_", "*_", "(_", "2_", "**_", "l_", ")_", "]_", "._", "flatten_", "(_", ")_", ",_", "'", "raw", "'_", ",_", "'", "RGB", "A", "'_", ",_", "0_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", "out", "img", " ", "=", " ", "Image", ".", "from", "buffer", " ", "(", " ", "'", "L", "',", " ", "(", "tiles", "z", "*(", "2", "**", "l", "),", "tiles", "z", "(", "2", "**", "l", "))", ",", " ", "tiled", "ata", "[", "y", "*", "tiles", "z", "*(", "2", "**", "l", "):", "(", "y", "+", "1", ")*", "tiles", "z", "*(", "2", "**", "l", "),", "x", "*", "tiles", "z", "*(", "2", "**", "l", "):", "(", "x", "+", "1", ")*", "tiles", "z", "*(", "2", "**", "l", ")]", ".", "flat", "ten", "()", ",", " ", "'", "raw", "',", " ", "'", "L", "',", " ", "0", ",", " ", "1", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "out", "img_", "=_", "out", "img_", "._", "resize_", "(_", "[_", "tiles", "z_", ",_", "tiles", "z_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "img_", "._", "save_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "'%", "s", "/", "%", "s", "/", "%", "s", "/", "%", "s", "\\u", "%", "s", ".", "png", "'_", "%_", "(_", "result_", "._", "output", "path_", ",_", "l_", ",_", "sl_", ",_", "y_", ",_", "x_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'%", "s", "/", "%", "s", "/", "%", "s", "/", "%", "s", "\\u", "%", "s", ".", "png", "'_", "%_", "(_", "result_", "._", "output", "path_", ",_", "l_", ",_", "sl_", ",_", "y_", ",_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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 ]
Unused local variable
boldport/pcbmode/pcbmode/utils/bom.py
[ { "content": "def make_bom(quantity=None):\n \"\"\"\n \n \"\"\"\n\n def natural_key(string_):\n \"\"\"See http://www.codinghorror.com/blog/archives/001018.html\"\"\"\n return [int(s) if s.isdigit() else s for s in re.split(r'(\\d+)', string_)]\n\n\n \n dnp_text = 'Do not populate'\n uncateg_text = 'Uncategorised'\n\n components_dict = config.brd['components']\n \n bom_dict = {}\n\n for refdef in components_dict:\n\n description = ''\n\n try:\n place = components_dict[refdef]['place']\n except:\n place = True\n\n try:\n ignore = components_dict[refdef]['bom']['ignore']\n except:\n ignore = False\n\n # If component isn't placed, ignore it\n if place == True and ignore == False:\n\n # Get footprint definition and shapes\n try:\n footprint_name = components_dict[refdef]['footprint']\n except:\n msg.error(\"Cannot find a 'footprint' name for refdef %s.\" % refdef)\n \n # Open footprint file\n fname = os.path.join(config.cfg['base-dir'],\n config.cfg['locations']['components'],\n footprint_name + '.json')\n footprint_dict = utils.dictFromJsonFile(fname)\n \n info_dict = footprint_dict.get('info') or {}\n \n try: \n comp_bom_dict = components_dict[refdef]['bom']\n except:\n comp_bom_dict = {}\n \n try: \n fp_bom_dict = footprint_dict['info']\n except:\n fp_bom_dict = {}\n \n \n # Override component BoM info on top of footprint info\n for key in comp_bom_dict:\n fp_bom_dict[key] = comp_bom_dict[key]\n\n description = fp_bom_dict.get('description') or uncateg_text\n\n try:\n dnp = components_dict[refdef]['bom']['dnp']\n except:\n dnp = False \n\n if dnp == True:\n description = dnp_text\n \n if description not in bom_dict:\n bom_dict[description] = fp_bom_dict\n bom_dict[description]['refdefs'] = []\n bom_dict[description]['refdefs'].append(refdef)\n \n bom_dict[description]['placement'] = components_dict[refdef]['layer']\n \n\n try:\n bom_content = config.brd['bom']\n except:\n bom_content = [\n {\n \"field\": \"line-item\",\n \"text\": \"#\"\n },\n {\n \"field\": \"quantity\",\n \"text\": \"Qty\"\n },\n {\n \"field\": \"designators\",\n \"text\": \"Designators\"\n }, \n {\n \"field\": \"description\",\n \"text\": \"Description\"\n }, \n {\n \"field\": \"package\",\n \"text\": \"Package\"\n }, \n {\n \"field\": \"manufacturer\",\n \"text\": \"Manufacturer\"\n }, \n {\n \"field\": \"part-number\",\n \"text\": \"Part #\"\n },\n {\n \"field\": \"suppliers\",\n \"text\": \"Suppliers\",\n \"suppliers\": \n [\n {\n \"field\": \"farnell\",\n \"text\": \"Farnell #\",\n \"search-url\": \"http://uk.farnell.com/catalog/Search?st=\"\n },\n { \n \"field\": \"mouser\",\n \"text\": \"Mouser #\",\n \"search-url\": \"http://uk.mouser.com/Search/Refine.aspx?Keyword=\"\n },\n {\n \"field\": \"octopart\",\n \"text\": \"Octopart\",\n \"search-url\": \"https://octopart.com/search?q=\"\n }\n ]\n }, \n {\n \"field\": \"placement\",\n \"text\": \"Layer\"\n }, \n {\n \"field\": \"notes\",\n \"text\": \"Notes\"\n }\n ]\n\n\n\n # Set up the BoM file name\n bom_path = os.path.join(config.cfg['base-dir'],\n config.cfg['locations']['build'],\n 'bom')\n # Create path if it doesn't exist already\n utils.create_dir(bom_path)\n\n board_name = config.cfg['name']\n board_revision = config.brd['config'].get('rev')\n base_name = \"%s_rev_%s\" % (board_name, board_revision)\n\n bom_html = os.path.join(bom_path, base_name + '_%s.html'% 'bom')\n bom_csv = os.path.join(bom_path, base_name + '_%s.csv'% 'bom')\n\n\n html = []\n csv = []\n\n\n html.append('<html>')\n html.append('<style type=\"text/css\">')\n try:\n css = config.stl['layout']['bom']['css']\n except:\n css = []\n for line in css:\n html.append(line)\n html.append('</style>')\n html.append('<table class=\"tg\">')\n\n header = []\n for item in bom_content:\n if item['field'] == 'suppliers':\n for supplier in item['suppliers']:\n header.append(\"%s\" % supplier['text'])\n else:\n header.append(\"%s\" % item['text'])\n if item['field'] == 'quantity' and quantity != None:\n header.append(\"@%s\" % quantity)\n\n html.append(' <tr>')\n html.append(' <th class=\"tg-title\" colspan=\"%s\">Bill of materials -- %s rev %s</th>' % (len(header), board_name, board_revision))\n html.append(' </tr>') \n html.append(' <tr>')\n for item in header:\n html.append(' <th class=\"tg-header\">%s</th>' % item)\n html.append(' </tr>')\n \n\n uncateg_content = []\n dnp_content = []\n index = 1\n\n for desc in bom_dict:\n content = []\n for item in bom_content:\n if item['field'] == 'line-item':\n content.append(\"<strong>%s</strong>\" % str(index))\n elif item['field'] == 'suppliers':\n for supplier in item['suppliers']:\n\n try:\n number = bom_dict[desc][item['field']][supplier['field']]\n except:\n number = \"\"\n\n search_url = supplier.get('search-url')\n if search_url != None:\n content.append('<a href=\"%s%s\">%s</a>' % (search_url, number, number))\n else:\n content.append(number)\n\n elif item['field'] == 'quantity':\n units = len(bom_dict[desc]['refdefs'])\n content.append(\"%s\" % (str(units)))\n if quantity != None:\n content.append(\"%s\" % (str(units*int(quantity))))\n elif item['field'] == 'designators':\n # Natural/human sort the list of designators\n sorted_list = sorted(bom_dict[desc]['refdefs'], key=natural_key)\n\n refdefs = ''\n for refdef in sorted_list[:-1]:\n refdefs += \"%s \" % refdef\n refdefs += \"%s\" % sorted_list[-1]\n content.append(\"%s \" % refdefs)\n elif item['field'] == 'description':\n content.append(\"%s \" % desc)\n else:\n try:\n content.append(bom_dict[desc][item['field']])\n except:\n content.append(\"\")\n\n if desc == uncateg_text:\n uncateg_content = content\n elif desc == dnp_text:\n dnp_content = content\n else:\n html.append(' <tr>')\n for item in content:\n html.append(' <td class=\"tg-item-%s\">%s</td>' % (('odd','even')[index%2==0], item))\n html.append(' </tr>')\n index += 1\n\n\n for content in (dnp_content, uncateg_content):\n html.append(' <tr class=\"tg-skip\">')\n html.append(' </tr>') \n html.append(' <tr>')\n if len(content) > 0:\n content[0] = index\n for item in content:\n html.append(' <td class=\"tg-item-%s\">%s</td>' % (('odd','even')[index%2==0], item))\n html.append(' </tr>')\n index += 1\n\n\n html.append('</table>')\n\n html.append('<p>Generated by <a href=\"http://pcbmode.com\">PCBmodE</a>, an open source PCB design software. PCBmodE was written and is maintained by <a href=\"http://boldport.com\">Boldport</a>, creators of beautifully functional circuits.')\n\n html.append('</html>')\n\n with open(bom_html, \"wb\") as f:\n for line in html:\n f.write(line+'\\n')\n\n \n #print bom_dict", "metadata": "root.make_bom", "header": "['module', '___EOS___']", "index": 22 } ]
[ { "span": "bom_csv ", "start_line": 182, "start_column": 4, "end_line": 182, "end_column": 11 }, { "span": "csv ", "start_line": 186, "start_column": 4, "end_line": 186, "end_column": 7 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "make", "\\u", "bom", "_", "(_", "quantity_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "natur", "al", "\\u", "key_", "(_", "string", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "See", " ", "http", "://", "www", ".", "codi", "ngh", "orr", "or", ".", "com", "/", "blog", "/", "archives", "/", "0010", "18.", "html", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "int_", "(_", "s_", ")_", "if_", "s_", "._", "isdigit_", "(_", ")_", "else_", "s_", "for_", "s_", "in_", "re_", "._", "split_", "(_", "r", "'(\\\\", "d", "+)'_", ",_", "string", "\\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_", "dn", "p", "\\u", "text_", "=_", "'", "Do", " ", "not", " ", "populate", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unca", "teg", "\\u", "text_", "=_", "'", "Unc", "ate", "gori", "sed", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "component", "s", "\\u", "dict_", "=_", "config_", "._", "brd", "_", "[_", "'", "component", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "bom", "\\u", "dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "ref", "def_", "in_", "component", "s", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "description_", "=_", "''_", "\\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 ", " _", "place_", "=_", "component", "s", "\\u", "dict_", "[_", "ref", "def_", "]_", "[_", "'", "place", "'_", "]_", "\\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 ", " _", "place_", "=_", "True_", "\\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 ", " _", "ignore_", "=_", "component", "s", "\\u", "dict_", "[_", "ref", "def_", "]_", "[_", "'", "bom", "'_", "]_", "[_", "'", "ignore", "'_", "]_", "\\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 ", " _", "ignore_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "component", " ", "isn", "'", "t", " ", "place", "d", ",", " ", "ignore", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "place_", "==_", "True_", "and_", "ignore_", "==_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "footprint", " ", "definit", "ion", " ", "and", " ", "shapes_", "\\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 ", " _", "footprint", "\\u", "name_", "=_", "component", "s", "\\u", "dict_", "[_", "ref", "def_", "]_", "[_", "'", "footprint", "'_", "]_", "\\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 ", " _", "msg_", "._", "error_", "(_", "\"", "Cann", "ot", " ", "find", " ", "a", " ", "'", "footprint", "'", " ", "name", " ", "for", " ", "ref", "def", " ", "%", "s", ".\"_", "%_", "ref", "def_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Open", " ", "footprint", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fname_", "=_", "os_", "._", "path_", "._", "join_", "(_", "config_", "._", "cfg_", "[_", "'", "base", "-", "dir", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "config_", "._", "cfg_", "[_", "'", "location", "s", "'_", "]_", "[_", "'", "component", "s", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "footprint", "\\u", "name_", "+_", "'.", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "footprint", "\\u", "dict_", "=_", "utils_", "._", "dict", "Fro", "m", "Js", "on", "File_", "(_", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "info", "\\u", "dict_", "=_", "footprint", "\\u", "dict_", "._", "get_", "(_", "'", "info", "'_", ")_", "or_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "comp", "\\u", "bom", "\\u", "dict_", "=_", "component", "s", "\\u", "dict_", "[_", "ref", "def_", "]_", "[_", "'", "bom", "'_", "]_", "\\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 ", " _", "comp", "\\u", "bom", "\\u", "dict_", "=_", "{_", "}_", "\\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 ", " _", "fp", "\\u", "bom", "\\u", "dict_", "=_", "footprint", "\\u", "dict_", "[_", "'", "info", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fp", "\\u", "bom", "\\u", "dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Override", " ", "component", " ", "Bo", "M", " ", "info", " ", "on", " ", "top", " ", "of", " ", "footprint", " ", "info_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "key_", "in_", "comp", "\\u", "bom", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fp", "\\u", "bom", "\\u", "dict_", "[_", "key_", "]_", "=_", "comp", "\\u", "bom", "\\u", "dict_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "description_", "=_", "fp", "\\u", "bom", "\\u", "dict_", "._", "get_", "(_", "'", "description", "'_", ")_", "or_", "unca", "teg", "\\u", "text_", "\\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 ", " _", "dn", "p_", "=_", "component", "s", "\\u", "dict_", "[_", "ref", "def_", "]_", "[_", "'", "bom", "'_", "]_", "[_", "'", "dn", "p", "'_", "]_", "\\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 ", " _", "dn", "p_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "dn", "p_", "==_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "description_", "=_", "dn", "p", "\\u", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "description_", "not_", "in_", "bom", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bom", "\\u", "dict_", "[_", "description_", "]_", "=_", "fp", "\\u", "bom", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bom", "\\u", "dict_", "[_", "description_", "]_", "[_", "'", "ref", "def", "s", "'_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "bom", "\\u", "dict_", "[_", "description_", "]_", "[_", "'", "ref", "def", "s", "'_", "]_", "._", "append_", "(_", "ref", "def_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "bom", "\\u", "dict_", "[_", "description_", "]_", "[_", "'", "placem", "ent", "'_", "]_", "=_", "component", "s", "\\u", "dict_", "[_", "ref", "def_", "]_", "[_", "'", "layer", "'_", "]_", "\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bom", "\\u", "content_", "=_", "config_", "._", "brd", "_", "[_", "'", "bom", "'_", "]_", "\\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 ", " _", "bom", "\\u", "content_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "field", "\"_", ":_", "\"", "line", "-", "item", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "text", "\"_", ":_", "\"#\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "field", "\"_", ":_", "\"", "quanti", "ty", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "text", "\"_", ":_", "\"", "Qt", "y", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "field", "\"_", ":_", "\"", "designat", "ors", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "text", "\"_", ":_", "\"", "Designat", "ors", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "field", "\"_", ":_", "\"", "description", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "text", "\"_", ":_", "\"", "Descripti", "on", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "field", "\"_", ":_", "\"", "package", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "text", "\"_", ":_", "\"", "Packa", "ge", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "field", "\"_", ":_", "\"", "manufactur", "er", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "text", "\"_", ":_", "\"", "Manufacturer", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "field", "\"_", ":_", "\"", "part", "-", "number", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "text", "\"_", ":_", "\"", "Part", " ", "#\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "field", "\"_", ":_", "\"", "supplier", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "text", "\"_", ":_", "\"", "Supplier", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "supplier", "s", "\"_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "field", "\"_", ":_", "\"", "far", "nell", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "text", "\"_", ":_", "\"", "Far", "nell", " ", "#\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "search", "-", "url", "\"_", ":_", "\"", "http", "://", "uk", ".", "far", "nell", ".", "com", "/", "catal", "og", "/", "Sear", "ch", "?", "st", "=\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "field", "\"_", ":_", "\"", "mouse", "r", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "text", "\"_", ":_", "\"", "Mouse", "r", " ", "#\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "search", "-", "url", "\"_", ":_", "\"", "http", "://", "uk", ".", "mouse", "r", ".", "com", "/", "Sear", "ch", "/", "Ref", "ine", ".", "asp", "x", "?", "Key", "word", "=\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "field", "\"_", ":_", "\"", "octop", "art", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "text", "\"_", ":_", "\"", "Oct", "opa", "rt", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "search", "-", "url", "\"_", ":_", "\"", "https", "://", "octop", "art", ".", "com", "/", "search", "?", "q", "=\"_", "\\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_", "\"", "field", "\"_", ":_", "\"", "placem", "ent", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "text", "\"_", ":_", "\"", "Layer", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "field", "\"_", ":_", "\"", "note", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "text", "\"_", ":_", "\"", "Not", "es", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "up", " ", "the", " ", "Bo", "M", " ", "file", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "bom", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "config_", "._", "cfg_", "[_", "'", "base", "-", "dir", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "config_", "._", "cfg_", "[_", "'", "location", "s", "'_", "]_", "[_", "'", "build", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bom", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "path", " ", "if", " ", "it", " ", "doe", "sn", "'", "t", " ", "exist", " ", "alr", "ead", "y_", "\\u\\u\\uNL\\u\\u\\u_", "utils_", "._", "create", "\\u", "dir_", "(_", "bom", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "board", "\\u", "name_", "=_", "config_", "._", "cfg_", "[_", "'", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "board", "\\u", "revision_", "=_", "config_", "._", "brd", "_", "[_", "'", "config", "'_", "]_", "._", "get_", "(_", "'", "rev", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "base", "\\u", "name_", "=_", "\"%", "s", "\\u", "rev", "\\u", "%", "s", "\"_", "%_", "(_", "board", "\\u", "name_", ",_", "board", "\\u", "revision_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "bom", "\\u", "html_", "=_", "os_", "._", "path_", "._", "join_", "(_", "bom", "\\u", "path_", ",_", "base", "\\u", "name_", "+_", "'\\u", "%", "s", ".", "html", "'_", "%_", "'", "bom", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bom", "\\u", "csv_", "=_", "os_", "._", "path_", "._", "join_", "(_", "bom", "\\u", "path_", ",_", "base", "\\u", "name_", "+_", "'\\u", "%", "s", ".", "csv", "'_", "%_", "'", "bom", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "html_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "csv_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "html_", "._", "append_", "(_", "'<", "html", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "'<", "style", " ", "type", "=\"", "text", "/", "css", "\">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "css_", "=_", "config_", "._", "stl", "_", "[_", "'", "layout", "'_", "]_", "[_", "'", "bom", "'_", "]_", "[_", "'", "css", "'_", "]_", "\\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 ", " _", "css_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "line_", "in_", "css_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "html_", "._", "append_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "html_", "._", "append_", "(_", "'<", "/", "style", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "'<", "table", " ", "class", "=\"", "tg", "\">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "header_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "bom", "\\u", "content_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "item_", "[_", "'", "field", "'_", "]_", "==_", "'", "supplier", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "supplier", "_", "in_", "item_", "[_", "'", "supplier", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "header_", "._", "append_", "(_", "\"%", "s", "\"_", "%_", "supplier", "_", "[_", "'", "text", "'_", "]_", ")_", "\\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 ", " _", "header_", "._", "append_", "(_", "\"%", "s", "\"_", "%_", "item_", "[_", "'", "text", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "item_", "[_", "'", "field", "'_", "]_", "==_", "'", "quanti", "ty", "'_", "and_", "quantity_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "header_", "._", "append_", "(_", "\"@", "%", "s", "\"_", "%_", "quantity_", ")_", "\\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_", "html_", "._", "append_", "(_", "'", " ", " ", "<", "tr", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "'", " ", " ", " ", " ", "<", "th", " ", "class", "=\"", "tg", "-", "title", "\"", " ", "colsp", "an", "=\"", "%", "s", "\">", "Bill", " ", "of", " ", "material", "s", " ", "--", " ", "%", "s", " ", "rev", " ", "%", "s", "</", "th", ">'_", "%_", "(_", "len_", "(_", "header_", ")_", ",_", "board", "\\u", "name_", ",_", "board", "\\u", "revision_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "'", " ", " ", "</", "tr", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "'", " ", " ", "<", "tr", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "header_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "html_", "._", "append_", "(_", "'", " ", " ", " ", " ", "<", "th", " ", "class", "=\"", "tg", "-", "header", "\">", "%", "s", "</", "th", ">'_", "%_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "html_", "._", "append_", "(_", "'", " ", " ", "</", "tr", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "unca", "teg", "\\u", "content_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dn", "p", "\\u", "content_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "desc_", "in_", "bom", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "content_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "bom", "\\u", "content_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "item_", "[_", "'", "field", "'_", "]_", "==_", "'", "line", "-", "item", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "content_", "._", "append_", "(_", "\"<", "strong", ">", "%", "s", "</", "strong", ">\"_", "%_", "str_", "(_", "index_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "item_", "[_", "'", "field", "'_", "]_", "==_", "'", "supplier", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "supplier", "_", "in_", "item_", "[_", "'", "supplier", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "number_", "=_", "bom", "\\u", "dict_", "[_", "desc_", "]_", "[_", "item_", "[_", "'", "field", "'_", "]_", "]_", "[_", "supplier", "_", "[_", "'", "field", "'_", "]_", "]_", "\\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 ", " ", " _", "number_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "search", "\\u", "url_", "=_", "supplier", "_", "._", "get_", "(_", "'", "search", "-", "url", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "search", "\\u", "url_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "content_", "._", "append_", "(_", "'<", "a", " ", "href", "=\"", "%", "s", "%", "s", "\">", "%", "s", "</", "a", ">'_", "%_", "(_", "search", "\\u", "url_", ",_", "number_", ",_", "number_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "content_", "._", "append_", "(_", "number_", ")_", "\\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_", "elif_", "item_", "[_", "'", "field", "'_", "]_", "==_", "'", "quanti", "ty", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "units_", "=_", "len_", "(_", "bom", "\\u", "dict_", "[_", "desc_", "]_", "[_", "'", "ref", "def", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content_", "._", "append_", "(_", "\"%", "s", "\"_", "%_", "(_", "str_", "(_", "units_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "quantity_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "content_", "._", "append_", "(_", "\"%", "s", "\"_", "%_", "(_", "str_", "(_", "units_", "*_", "int_", "(_", "quantity_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "item_", "[_", "'", "field", "'_", "]_", "==_", "'", "designat", "ors", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Nat", "ural", "/", "human", " ", "sort", " ", "the", " ", "list", " ", "of", " ", "designat", "ors_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sorte", "d\\u", "list_", "=_", "sorted_", "(_", "bom", "\\u", "dict_", "[_", "desc_", "]_", "[_", "'", "ref", "def", "s", "'_", "]_", ",_", "key_", "=_", "natur", "al", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ref", "defs_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "ref", "def_", "in_", "sorte", "d\\u", "list_", "[_", ":_", "-_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "ref", "defs_", "+=_", "\"%", "s", " ", "\"_", "%_", "ref", "def_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ref", "defs_", "+=_", "\"%", "s", "\"_", "%_", "sorte", "d\\u", "list_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content_", "._", "append_", "(_", "\"%", "s", " ", "\"_", "%_", "ref", "defs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "item_", "[_", "'", "field", "'_", "]_", "==_", "'", "description", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "content_", "._", "append_", "(_", "\"%", "s", " ", "\"_", "%_", "desc_", ")_", "\\u\\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 ", " ", "_", "content_", "._", "append_", "(_", "bom", "\\u", "dict_", "[_", "desc_", "]_", "[_", "item_", "[_", "'", "field", "'_", "]_", "]_", ")_", "\\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 ", " ", "_", "content_", "._", "append_", "(_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "desc_", "==_", "unca", "teg", "\\u", "text_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unca", "teg", "\\u", "content_", "=_", "content_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "desc_", "==_", "dn", "p", "\\u", "text_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dn", "p", "\\u", "content_", "=_", "content_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "html_", "._", "append_", "(_", "'", " ", " ", "<", "tr", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "content_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "html_", "._", "append_", "(_", "'", " ", " ", " ", " ", "<", "td", " ", "class", "=\"", "tg", "-", "item", "-%", "s", "\">", "%", "s", "</", "td", ">'_", "%_", "(_", "(_", "'", "odd", "'_", ",_", "'", "even", "'_", ")_", "[_", "index_", "%_", "2_", "==_", "0_", "]_", ",_", "item_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "html_", "._", "append_", "(_", "'", " ", " ", "</", "tr", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "content_", "in_", "(_", "dn", "p", "\\u", "content_", ",_", "unca", "teg", "\\u", "content_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "html_", "._", "append_", "(_", "'", " ", " ", "<", "tr", " ", "class", "=\"", "tg", "-", "skip", "\">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "'", " ", " ", "</", "tr", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "'", " ", " ", "<", "tr", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "content_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "content_", "[_", "0_", "]_", "=_", "index_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "item_", "in_", "content_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "html_", "._", "append_", "(_", "'", " ", " ", " ", " ", "<", "td", " ", "class", "=\"", "tg", "-", "item", "-%", "s", "\">", "%", "s", "</", "td", ">'_", "%_", "(_", "(_", "'", "odd", "'_", ",_", "'", "even", "'_", ")_", "[_", "index_", "%_", "2_", "==_", "0_", "]_", ",_", "item_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "html_", "._", "append_", "(_", "'", " ", " ", "</", "tr", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index_", "+=_", "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_", "html_", "._", "append_", "(_", "'<", "/", "table", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "html_", "._", "append_", "(_", "'<", "p", ">", "Generate", "d", " ", "by", " ", "<", "a", " ", "href", "=\"", "http", "://", "pc", "bm", "ode", ".", "com", "\">", "PC", "Bm", "od", "E", "</", "a", ">", ",", " ", "an", " ", "open", " ", "source", " ", "PC", "B", " ", "design", " ", "software", ".", " ", "PC", "Bm", "od", "E", " ", "was", " ", "writt", "en", " ", "and", " ", "is", " ", "maintain", "ed", " ", "by", " ", "<", "a", " ", "href", "=\"", "http", "://", "bold", "port", ".", "com", "\">", "Bol", "dport", "</", "a", ">", ",", " ", "creat", "ors", " ", "of", " ", "beautif", "ull", "y", " ", "functional", " ", "circuit", "s", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "html_", "._", "append_", "(_", "'<", "/", "html", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "open_", "(_", "bom", "\\u", "html_", ",_", "\"", "wb", "\"_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "line_", "in_", "html_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "line_", "+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